Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Tell a friend success, weird bug


Monika in Germany

Recommended Posts

bug_tellafriend.gif

 

After the email is successfully sent, I get the message in the top left ... looking horrible.

 

Waht to do, what to do?

 

Here is my code, I don't think I changed it from default ...

 

right at the top, bedore the html part:

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

 

and in the body part:

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
<!-- body_text //-->
   <td width="100%" valign="top"><?php echo tep_draw_form('email_friend', tep_href_link(FILENAME_TELL_A_FRIEND, 'action=process&products_id=' . $HTTP_GET_VARS['products_id'])); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">

<!-- title //-->
<?php require(DIR_WS_INCLUDES . 'title_tell_a_friend.php'); ?>
<!-- title_eof //-->

<?php
 if ($messageStack->size('friend') > 0) {
?>
     <tr>
       <td><?php echo $messageStack->output('friend'); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
 }
?>

 

why on earth does it show up at the top?

 

TIA

Monika

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

not a bug really.

you need to look at the $messageStack info.

if it returns $error=true

the $messsageStack is set to ('friend', SOME_ERROR_TEXT)

see tell_a_friend.php:

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

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

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

and the error is built in the html area of tell_a_friend.php

and plugs it in here:

<?php
 if ($messageStack->size('friend') > 0) {
?>
     <tr>
       <td><?php echo $messageStack->output('friend'); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
 }
?>

when it is not an error see it is set to 'header' and 'success' and saved for a redirect:

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

which then plugs the info into the header of product_info.php file.

header.php

  if ($messageStack->size('header') > 0) {
   echo $messageStack->output('header');
 }  

and in application_top.php (required on all pages) we see that:

// initialize the message stack for output messages
 require(DIR_WS_CLASSES . 'message_stack.php');
 $messageStack = new messageStack;

so look at the catalog/includes/classes/message_stack.php file

 

yikes. its all tied in with that $messageStack "stuff"

well, that answers your question "why on earth does it show up at the top?"

that's why.

 

im not sure how to move that code out of the header,

it happens after the redirect when the customer clicks continue from the tell a friend page.

 

my only guess would be to add a new page to redirect to, an email sent page

or something with a success message similar to the final checkout page after an order. with a continue button to send them back to the product page.

?

Link to comment
Share on other sites

hi Michael,

 

I stole a message call from another file, added it to the body part of product-info, changed "header" to "friend" and called it there ... voil?, text is where it belongs, right above the product info. I think it IS a bug as in addressbook, when new addesses are added, the text for success does not go up to the header but above the inner body part. TG I managed to fix it :-).

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...