The Tell a Friend feature on osCommerce is a popular feature.
Is it? You don't really know, do you? And who is sending what?
And what are they saying?
Might be your competitor telling his buddies to adapt their price to 90% of yours?
A very simple but sufficient hack in /catalog/tell_a_friend.php will give the answers to all above questions.
And ofcoarse silently.. so the customer never knows, just like we SysGods like it
Changes to make
In /catalog/tell_a_friend.php (around line 139) where the tep_mail() function is called you add the following AFTER the tep_mail() line:
CODE
// Mail a (silent) report to the web owner:
// get ip
if (getenv('HTTP_X_FORWARDED_FOR')) {
$ip=getenv('HTTP_X_FORWARDED_FOR');
} else {
$ip=getenv('REMOTE_ADDR');
}
// build report
$report = 'Here are the details of the T.A.F. submission by ' . $from_name . ' on ' . date("D M j G:i:s Y") . ':';
$report .= "nn" . 'Recipient details: ' . $HTTP_POST_VARS['friendname'] . ' - ' . $HTTP_POST_VARS['friendemail'];
$report .= "n" . 'Sender details: ' . $from_name . ' - ' . $from_email_address;
$report .= "n" . 'Sender ip address: ' . $ip;
$report .= "n" . 'Personal message: ' . "nn" . $HTTP_POST_VARS['yourmessage'];
$report .= "nn" . 'Product link: ' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_PRODUCT_INFO . '?products_id=' . $HTTP_GET_VARS['products_id'];
// mail report
tep_mail('Tell A Friend', 'you@youraddress.com', '[ REPORT ] Tell a Friend Usage', stripslashes($report), '', $from_email_address);
// get ip
if (getenv('HTTP_X_FORWARDED_FOR')) {
$ip=getenv('HTTP_X_FORWARDED_FOR');
} else {
$ip=getenv('REMOTE_ADDR');
}
// build report
$report = 'Here are the details of the T.A.F. submission by ' . $from_name . ' on ' . date("D M j G:i:s Y") . ':';
$report .= "nn" . 'Recipient details: ' . $HTTP_POST_VARS['friendname'] . ' - ' . $HTTP_POST_VARS['friendemail'];
$report .= "n" . 'Sender details: ' . $from_name . ' - ' . $from_email_address;
$report .= "n" . 'Sender ip address: ' . $ip;
$report .= "n" . 'Personal message: ' . "nn" . $HTTP_POST_VARS['yourmessage'];
$report .= "nn" . 'Product link: ' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_PRODUCT_INFO . '?products_id=' . $HTTP_GET_VARS['products_id'];
// mail report
tep_mail('Tell A Friend', 'you@youraddress.com', '[ REPORT ] Tell a Friend Usage', stripslashes($report), '', $from_email_address);
Things to remember
Note that if you use MIME e-mail you should change all occurances of "n" to "<br>".
Furthermore you should obviously change the e-mail address used to reflect your own.
Regards,
Mattice
PS:
QUOTE
// mail report - NOTE THE BLUE ADDITION!
tep_mail('Tell A Friend', 'you@youraddress.com', '[ REPORT ] Tell a Friend Usage', stripslashes($report), '', $from_email_address, '');
tep_mail('Tell A Friend', 'you@youraddress.com', '[ REPORT ] Tell a Friend Usage', stripslashes($report), '', $from_email_address, '');

