Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Another tell a friend

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 01-13-2004, 11:30 AM
 
krishmandal krishmandal is offline
 

Advanced Member
  
Join Date: Oct 2003
Posts: 62
 

Default Another tell a friend

If you guys go to this page:

http://fineartphotogifts.com/shop/customer/product.php?productid=16140&cat=256&page=1

you will see the second box under the thumbnail is "Tell Your Friends."

Others have done this before, and the code is on these boards somewhere.

But if you're interested in this one, then let me know, and I'll post all the stuff you need.

WHY IS THIS DIFFERENT? Because it LOGS in a DB table all the emails that are going out. It logs the senders email address, the recipient's email address, the page that was sent, the timestamp, and the message that was sent, if any.

Some people may not agree with this, and you do what you want with this information.

The original idea was mine and the code was done by a guy I work with for our corporate site (work), so I cannot take credit for it. But I modified it ever so slightly and made it work with my site.
Reply With Quote
  #2  
Old 01-13-2004, 12:51 PM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

Sounds interesting, why not just post the code.

there will always be someone interested
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #3  
Old 01-13-2004, 12:56 PM
  leon's Avatar 
leon leon is offline
 

X-Wizard
  
Join Date: Mar 2003
Location: Costa Rica
Posts: 1,213
 

Default

Very nice, why dont you post the code here on the forums.

Or pack it up (zip), upload it somewhere and give us the link.
__________________
It doesn\'t matter what is done... it is how it is done.
=============================
XCart Version: 3.5.3 -> Dmcigars.com
XCart Version: 4.1.3....
Reply With Quote
  #4  
Old 01-13-2004, 01:28 PM
 
krishmandal krishmandal is offline
 

Advanced Member
  
Join Date: Oct 2003
Posts: 62
 

Default

Okay, here's the goods... I didn't know if I should chew up bandwidth unless people actually wanted to see it, but it looks like there's some interest...

First add a table into your shop DB, with the following SQL (this is made easy if you have phpMyAdmin.


Code:
CREATE TABLE `tellafriend` ( `tafid` int(10) unsigned NOT NULL auto_increment, `link` varchar(255) NOT NULL default '', `send_name` varchar(255) NOT NULL default '', `send_email` varchar(255) NOT NULL default '', `rec_name` varchar(255) NOT NULL default '', `rec_email` varchar(255) NOT NULL default '', `subject` varchar(255) NOT NULL default '', `body` text, `timestamp` int(10) NOT NULL default '0', KEY `tafid` (`tafid`) ) TYPE=MyISAM AUTO_INCREMENT=161 ;

Copy this code into a file called connect.php and put it in the xcart/include directory. Be sure to replace all variables properly for the DB name, username and password:
Code:
<?php # # SQL database details # $sql_host ='localhost'; $sql_user ='user'; $sql_db ='db'; $sql_password ='pw'; db_connect($sql_host, $sql_user, $sql_password); db_select_db($sql_db); ?>


Next, add a directory under your root called /tellafriend. In this directory include the following index.php file. Be sure to replace all instances of my site-specific stuff with yours (URLs, image locations, etc.)

Code:
<?php include ("../shop/include/func.php"); include ("../shop/include/connect.php"); ?> <head> <title> Tell a Friend about Fine Art Photo Gifts</title> <style> td {font-family: Verdana; font-size: 12px; padding-left: 5px; padding-right: 5px; padding-top: 2px; padding-bottom: 3px;} </style> </head> <body> <?php if($submit) { # make sure all fields have data if($_SERVER['HTTP_HOST']=="www.fineartphotogifts.com") { if($rec_name!=""&&$rec_email!=""&&$send_name!=""&&$send_email!=""&&$subject!="") { # send email $message="Hello " . ucfirst("$rec_name") . "! \n\nYour friend $send_name at $send_email asked us to send you a brief note. \nPlease visit this page on fineartphotogifts.com at \n\n $link\n\n for more details.\n\n"; if($body!="") { $message.= ucfirst("$send_name") . " sends the following note to you:\n\n" .stripslashes($body)."\n\n\n"; $body="'$body'"; } else { $body="NULL"; } $message.="Hope to see you soon at Fine Art Photo Gifts!\n\nSincerely,\nWeb Team at www.fineartphotogifts.com,\n\"Affordable photographic art for home and office\"\n"; mail($rec_email,$subject,$message,"From: \"$send_email\" <$send_name>"); echo "<table><tr><td><img src=\"http://fineartphotogifts.com/images/graphics/fineartphotogifts_logo.gif\"> The following was sent to $rec_email ...</p><table width=\"98%\" bgcolor=\"#FFFFCC\"><tr><td> ".nl2br($message)."</p></td></tr></table><p align=\"center\"><a href=\"javascript:window.close();\">CLOSE WINDOW</a></p>"; # log to database $log=db_query("INSERT INTO tellafriend (tafid,link,send_name,send_email,rec_name,rec_email,subject,body,timestamp) VALUES (NULL,'$link','$send_name','$send_email','$rec_name','$rec_email','$subject',$body,".time().")"); } else { echo "All bolded fields are mandatory. Please use the back button on your browser and make sure all fields are filled in!\n"; } } else { echo "Not from fineartphotogifts.com!\n"; } } else { if($link =="") { $link = "www.fineartphotogifts.com"; } ?> <form action="<?php echo $PHP_SELF ?>" method="post"> <table width="400" cellpadding="0" cellspacing="0" border="0" style="background: #F0F0F0; border: 1px #6F6F6F solid;"> <tr><td colspan="2" style="background-color:#990000; color: #FFFFFF; font-weight: bold;">Tell a friend about Fine Art Photo Gifts!</td></tr> <tr><td colspan="2" style="padding: 10px; background-color: #FFFFFF; border-bottom: 1px #000 solid;">Send a brief note to a friend or colleague using this form. The note will be sent by Fine Art Photo Gifts on your behalf, and will reference this page: <span style="font-size:10px; color:red;"><?php echo $link ?></span> You may also add a personal note if you wish.</td></tr> <tr> <td nowrap>Your Name:</td> <td style="padding-top: 5px;" width="70%"><input type="text" name="send_name" style="width: 100%;"></td> </tr> <tr> <td nowrap style="border-bottom: 1px black solid;">Your E-Mail:</td> <td width="70%" style="border-bottom: 1px black solid;"><input type="text" name="send_email" style="width: 100%;"></td> </tr> <tr> <td nowrap>Friend's Name:</td> <td width="70%"><input type="text" name="rec_name" style="width: 100%;"></td> </tr> <tr> <td nowrap style="border-bottom: 1px black solid;">Friend's E-Mail:</td> <td width="70%" style="border-bottom: 1px black solid;"><input type="text" name="rec_email" style="width: 100%;"></td> </tr> <tr> <td style="padding-top:6px;">Subject:</td> <td width="70%" style="padding-top:6px;"><input type="text" name="subject" style="width: 100%;"></td> </tr> <tr><td colspan="2">Add your personal note below: <textarea name="body" style="width: 100%" rows="10"></textarea></td></tr> <tr><td colspan="2" align="right"><input type="submit" name="submit" value="Send"></td></tr> </table> <input type="hidden" name="link" value="<?php echo $link ?>"> </form> <?php } ?> </body> </html>

Create a template under /modules/upselling_products/tellafriend.tpl and fill it with this code. You may wish to get rid of the "width={$product.image_x}" portion if you are not putting Tellafriend under the thumbnail:
Code:
<table width={$product.image_x} style="border:1px silver solid;"> <tr><td align=left> <table width=90% cellpadding=0 cellspacing=0 border=0> <tr><td class="ProductDetailsTitle">Tell Your Friends[img]../skin1/images/tellafriend.gif[/img]</td></tr> <tr><td class=Line height="1">[img]{$ImagesDir}/spacer.gif[/img]</td></tr> <tr><td style="font-size:10px;"><ul>[*]Send your friends a link to this page![*]Print this page[/list]</td></tr> </table> </td> </tr> </table>

At the proper place in your /customer/main/product.tpl place this line:
Code:
{include file="modules/Upselling_Products/tellafriend.tpl}

to call the code onto the page.

That should be it. I think you have it all now. If you have questions, I'll try to help, but since I'm no guru like Shan, or Boomer, or some others I may fumble a bit. Let us know how well this works for you.
Reply With Quote
  #5  
Old 01-13-2004, 02:56 PM
  leon's Avatar 
leon leon is offline
 

X-Wizard
  
Join Date: Mar 2003
Location: Costa Rica
Posts: 1,213
 

Default

Really simple and nice, the way users like it. Seams to work smooth.

Have you tried generating the HTML catalog to test out the functionality of this in HTML ? Not sure, but it seams that the references might have an impact once you use it in HTML formated pages. I prefer to see it working first before I break my cart again, he, he.
__________________
It doesn\'t matter what is done... it is how it is done.
=============================
XCart Version: 3.5.3 -> Dmcigars.com
XCart Version: 4.1.3....
Reply With Quote
  #6  
Old 01-14-2004, 06:40 AM
 
krishmandal krishmandal is offline
 

Advanced Member
  
Join Date: Oct 2003
Posts: 62
 

Default

Leon,
Actually, I did try it on the HTML catalog, and it certainly does work fine there too.

Reply With Quote
  #7  
Old 01-14-2004, 06:52 AM
  leon's Avatar 
leon leon is offline
 

X-Wizard
  
Join Date: Mar 2003
Location: Costa Rica
Posts: 1,213
 

Default

Great ! Thanks for the reply... and test..
__________________
It doesn\'t matter what is done... it is how it is done.
=============================
XCart Version: 3.5.3 -> Dmcigars.com
XCart Version: 4.1.3....
Reply With Quote
  #8  
Old 01-25-2004, 06:28 PM
 
miss_beth miss_beth is offline
 

Advanced Member
  
Join Date: Dec 2003
Posts: 84
 

Default

On my current site, the one I'm replacing with xcart, I have a tell a friend feature and it bcc's me on all emails. Interesting reading.

Sometimes it ticks me off - like when they email other stores and say "I want this, can you beat their price?" (that happens a lot) but other times it's informative because I learn what customers REALLY think and that can be helpful when making decisions. Sometimes I wish I hadn't read them because people say some very personal things to each other. It'll start out, look at this product and end with uh, well, private conversation. I guess it never occurs to them that it's being logged.

Anyway, thanks for posting this. I've not yet decided if I want this feature on the new site, but if I do I will give this one a go. Anyone using it on the latest 3.5?

~Beth
__________________
X-Cart version 3.5.6
PHP 4.3.4
MySQL server 3.23.56
MySQL client 3.23.49
Web server Apache/1.3.31 (Unix)
Operation system Linux
Perl 5.008
Reply With Quote
  #9  
Old 01-25-2004, 11:20 PM
  leon's Avatar 
leon leon is offline
 

X-Wizard
  
Join Date: Mar 2003
Location: Costa Rica
Posts: 1,213
 

Default

Well, I started using it, but after a few tests I decided to use the other one (Im on 3.5.3 by the way).

This is a great Mod, but the other one was easier for Multilingual purposses, and also to keep it light on the database server, since I didnt see use in using tables for it, well not until you mentioned Bcc'ing the messages, although like you say, could get private.

It would be interesting to have a Send to friend mod that could log only what products are most recommended by friends and show it on the index or in an admin view, that would be good information for Marketing purposes for sure.
__________________
It doesn\'t matter what is done... it is how it is done.
=============================
XCart Version: 3.5.3 -> Dmcigars.com
XCart Version: 4.1.3....
Reply With Quote
  #10  
Old 01-26-2004, 04:36 AM
 
miss_beth miss_beth is offline
 

Advanced Member
  
Join Date: Dec 2003
Posts: 84
 

Default

In some cases, reading the info was helpful. People would say things like - this is cute but the picture is hard to see or I like this but I wish it came in blue (well, it did but I didn't have the blue one online yet) ect. In those instances having their input was helpful because I could fix what they were complaining about.

As to whether I'll put it on my new xcart site, still not sure. I really, really didn't like the ones that said "hey, can you beat this price" but I guess they can do that by just sending them the URL through email just as easy.

~Beth
__________________
X-Cart version 3.5.6
PHP 4.3.4
MySQL server 3.23.56
MySQL client 3.23.49
Web server Apache/1.3.31 (Unix)
Operation system Linux
Perl 5.008
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:22 PM.

   

 
X-Cart forums © 2001-2020