osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 

Tell a Friend feature

This is a discussion on Tell a Friend feature within the osCMax v2 Customization/Mods forums, part of the osCMax v2.0 Forums category; I have included the option to privately send an email to the site owner, but the recipient info is blank ...


Go Back   osCommerce and osCMax shopping cart software forums > osCMax v2.0 Forums > osCMax v2 Customization/Mods

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Closed Thread

 

LinkBack Thread Tools
  #1  
Old 08-12-2006, 09:16 AM
Active Member
 
Join Date: May 2003
Posts: 137
Thanks: 3
Thanked 1 Time in 1 Post
Rep Power: 0
countingsheep
Default Tell a Friend feature

I have included the option to privately send an email to the site owner, but the recipient info is blank when she receives the email. What do I need to change to get that to work? This is the code for tell a friend.php

Code:
<?php
/*
  $Id: tell_a_friend.php,v 1.4.2.1.2.2 2005/09/21 20:57:19 Michael Sasek Exp $

  osCMax Power E-Commerce
  http://oscdox.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

// Most of this file is changed or moved to BTS - Basic Template System - format.
// For adding in contribution or modification - parts of this file has been moved to: catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change).
//       catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change).
// (Sub 'fallback' with your current template to see if there is a template specific file.)

  require('includes/application_top.php');

  if (!tep_session_is_registered('customer_id') && (ALLOW_GUEST_TO_TELL_A_FRIEND == 'false')) {
    $navigation->set_snapshot();
    tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
  }

  $valid_product = false;
  if (isset($HTTP_GET_VARS['products_id'])) {
    $product_info_query = tep_db_query("select pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");
    if (tep_db_num_rows($product_info_query)) {
      $valid_product = true;

      $product_info = tep_db_fetch_array($product_info_query);
    } else {
      tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
    }
  }

// BOF: MOD - Article Manager
//if ($valid_product == false) {
//  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
  $valid_article = false;
  if (isset($HTTP_GET_VARS['articles_id'])) {
    $article_info_query = tep_db_query("select pd.articles_name from " . TABLE_ARTICLES . " p, " . TABLE_ARTICLES_DESCRIPTION . " pd where p.articles_status = '1' and p.articles_id = '" . (int)$HTTP_GET_VARS['articles_id'] . "' and p.articles_id = pd.articles_id and pd.language_id = '" . (int)$languages_id . "'");
    if (tep_db_num_rows($article_info_query)) {
      $valid_article = true;

      $article_info = tep_db_fetch_array($article_info_query);
    } else {
      tep_redirect(tep_href_link(FILENAME_ARTICLE_INFO, 'articles_id=' . $HTTP_GET_VARS['articles_id']));
    }
// EOF: MOD - Article Manager
  }

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_TELL_A_FRIEND);

  if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process')) {
    $error = false;

    $to_email_address = tep_db_prepare_input($HTTP_POST_VARS['to_email_address']);
    $to_name = tep_db_prepare_input($HTTP_POST_VARS['to_name']);
    $from_email_address = tep_db_prepare_input($HTTP_POST_VARS['from_email_address']);
    $from_name = tep_db_prepare_input($HTTP_POST_VARS['from_name']);
    $message = tep_db_prepare_input($HTTP_POST_VARS['message']);

    if (empty($from_name)) {
      $error = true;

      $messageStack->add('friend', ERROR_FROM_NAME);
    }

    if (!tep_validate_email($from_email_address)) {
      $error = true;

      $messageStack->add('friend', ERROR_FROM_ADDRESS);
    }

    if (empty($to_name)) {
      $error = true;

      $messageStack->add('friend', ERROR_TO_NAME);
    }
// 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 .= "\n\n" . '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: ' . "\n\n" . $HTTP_POST_VARS['yourmessage']; 
$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', 'lisa@thewoodshopintn.com', '[ REPORT ] Tell a Friend Usage', stripslashes($report), '', $from_email_address);

    if (!tep_validate_email($to_email_address)) {
      $error = true;

      $messageStack->add('friend', ERROR_TO_ADDRESS);
    }

    if ($error == false) {
// BOF: MOD - Article Manager
// Modify e-mail depending on whether product or article
// if product
    if ($valid_product) {
// EOF: MOD - Article Manager
      $email_subject = sprintf(TEXT_EMAIL_SUBJECT, $from_name, STORE_NAME);
      $email_body = sprintf(TEXT_EMAIL_INTRO, $to_name, $from_name, $product_info['products_name'], STORE_NAME) . "\n\n";

      if (tep_not_null($message)) {
        $email_body .= $message . "\n\n";
      }

      $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);

      $messageStack->add_session('header', sprintf(TEXT_EMAIL_SUCCESSFUL_SENT, $product_info['products_name'], tep_output_string_protected($to_name)), 'success');

      tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
// BOF: MOD - Article Manager
      // if article
    } else if ($valid_article) {
      $email_subject = sprintf(TEXT_EMAIL_SUBJECT, $from_name, STORE_NAME);
      $email_body = sprintf(TEXT_EMAIL_INTRO, $to_name, $from_name, $article_info['articles_name'], STORE_NAME) . "\n\n";

      if (tep_not_null($message)) {
        $email_body .= $message . "\n\n";
      }

      $email_body .= sprintf(TEXT_EMAIL_LINK_ARTICLE, tep_href_link(FILENAME_ARTICLE_INFO, 'articles_id=' . $HTTP_GET_VARS['articles_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);

      $messageStack->add_session('header', sprintf(TEXT_EMAIL_SUCCESSFUL_SENT, $article_info['articles_name'], tep_output_string_protected($to_name)), 'success');

      tep_redirect(tep_href_link(FILENAME_ARTICLE_INFO, 'articles_id=' . $HTTP_GET_VARS['articles_id']));
      }
// EOF: MOD - Article Manager
    }
  } elseif (tep_session_is_registered('customer_id')) {
    $account_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
    $account = tep_db_fetch_array($account_query);

    $from_name = $account['customers_firstname'] . ' ' . $account['customers_lastname'];
    $from_email_address = $account['customers_email_address'];
  }

// LINE ADDED: MOD - Article Manager
  if ($valid_product) {
    $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_TELL_A_FRIEND, 'products_id=' . $HTTP_GET_VARS['products_id']));
// BOF: MOD - Article Manager
  } else if ($valid_article) {
    $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_TELL_A_FRIEND, 'articles_id=' . $HTTP_GET_VARS['articles_id']));
      }
// EOF: MOD - Article Manager

  $content = CONTENT_TELL_A_FRIEND;

  include (bts_select('main', $content_template)); // BTSv1.5

  require(DIR_WS_INCLUDES . 'application_bottom.php');
?>
And here are the results of the email she receives..
----- Original Message -----
From: <xx.@xxx.com>
To: "Tell A Friend" <xxx@xxxx.com>
Sent: Saturday, August 12, 2006 10:36 AM
Subject: [ REPORT ] Tell a Friend Usage


>
> Here are the details of the T.A.F. submission by Toni on Sat Aug 12
> 10:36:25 2006:
>
> Recipient details: -
> Sender details: Toni - myemailaddress.com
> Sender ip address: 75.108.141.253
> Personal message:
>
>
>
> Product link:
> http://xxxxxx.com/~xxx/shop/product_...roducts_id=151


~~~Any suggestions on what to change in the code to make the recipient details to show? Ive narrowed it down to this line:
$report .= "\n\n" . 'Recipient details: ' . $HTTP_POST_VARS['friendname'] . ' - ' . $HTTP_POST_VARS['friendemail'];

but I dont know what to put in there.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Cannot tell a friend about articles jbanda osCMax v2 Features Discussion 0 08-17-2006 04:59 AM
Tell a Friend Box?? Kristine osCMax v1.7 General Mods Discussion 4 05-03-2004 05:19 AM
HTML email a friend adrenalinez osCommerce 2.2 Modification Help 0 09-03-2003 10:54 AM
Wierd return from 'Tip a friend' and more... Petter osCommerce 2.2 Installation Help 0 02-16-2003 04:58 AM
Email loaded shopping cart to a friend/client Anonymous osCommerce 2.2 Modification Help 2 11-25-2002 11:12 AM


All times are GMT -8. The time now is 07:39 AM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
http://www.oscmax.com/forums/
Copyright 2008 osCMax