RE: [TIP / TRICK] Tell A Friend Reporting

TB <[email protected]> 30 Jul 2003 00:37:55 -0000
Newsgroups gmane.comp.web.oscommerce.tips
Message-ID <388ff9e75c62cdcc55c85faddec7e886@osCommerce-Forums>
This message was sent from: Tips and Tricks
http://forums.oscommerce.com/viewtopic.php?p=204060#204060
----------------------------------------------------------------

The following works for me, running current 2.2 CVS.

Find this: (Approx lines 77 - 80)[code]      $email_body .= sprintf(TEXT_EMAIL_LINK, tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'])) . "\n\n" .
                     sprintf(TEXT_EMAIL_SIGNATURE, STORE_NAME . "\n" . HTTP_SERVER . DIR_WS_CATALOG . "\n");

      tep_mail($to_name, $to_email_address, $email_subject, $email_body, $from_name, $from_email_address);[/code]
Add this after above:[code]/* CC Tell a Friend - BOF */
// 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 Tell A Friend submission by ' . $from_name . ' on ' . date("D M j G:i:s Y") . ':'; 
    $report .= "\n\n" . 'Sender details: ' . $from_name . ' - ' . $from_email_address;
    $report .= "\n\n" . 'Recipient details: ' . $to_name . ' - ' . $to_email_address; 
    $report .= "\n\n" . 'Sender IP address: ' . $ip; 
    $report .= "\n\n" . 'Personal message: ' . "\n\n" . $message; 
    $report .= "\n\n" . 'Product link: ' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_PRODUCT_INFO . '?products_id=' . $HTTP_GET_VARS['products_id']; 

// mail report 
    tep_mail('Tell A Friend',  '[email protected]', '[ REPORT ] Tell a Friend Usage', tep_output_string_protected($report), $from_name, $from_email_address);
/* CC Tell a Friend - EOF */[/code]

Let me know how you go...
Tony