Jump to content

tsashergeyter

Members
  • Content count

    3
  • Joined

  • Last visited

1 Follower

Profile Information

  • Real Name
    Joe Wilson
  • Location
    Charlottesville, VA
  1. Ian, Sorry it has taken me so long to get back to you. I am pasting in the gv_admin.php file that you requested. To refresh your memory, I am having trouble with the value of the gift voucher as it appears in the emails sent from admin - they are coming up as $0.00 every time, no matter what amount I enter. -- <?php /* $Id: gv_mail.php,v 1.3.2.4 2003/05/12 22:54:01 wilt Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2002 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_CLASSES . 'currencies.php'); $currencies = new currencies(); if ( ($HTTP_GET_VARS['action'] == 'send_email_to_user') && ($HTTP_POST_VARS['customers_email_address'] || $HTTP_POST_VARS['email_to']) && (!$HTTP_POST_VARS['back_x']) ) { switch ($HTTP_POST_VARS['customers_email_address']) { case '***': $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS); $mail_sent_to = TEXT_ALL_CUSTOMERS; break; case '**D': $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'"); $mail_sent_to = TEXT_NEWSLETTER_CUSTOMERS; break; default: $customers_email_address = tep_db_prepare_input($HTTP_POST_VARS['customers_email_address']); $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($customers_email_address) . "'"); $mail_sent_to = $HTTP_POST_VARS['customers_email_address']; if ($HTTP_POST_VARS['email_to']) { $mail_sent_to = $HTTP_POST_VARS['email_to']; } break; } $from = tep_db_prepare_input($HTTP_POST_VARS['from']); $subject = tep_db_prepare_input($HTTP_POST_VARS['subject']); while ($mail = tep_db_fetch_array($mail_query)) { $id1 = create_coupon_code($mail['customers_email_address']); $message = $HTTP_POST_VARS['message']; $message .= "nn" . TEXT_GV_WORTH . $currencies->format($HTTP_POST_VARS['amount']) . "nn"; $message .= TEXT_TO_REDEEM; $message .= TEXT_WHICH_IS . $id1 . TEXT_IN_CASE . "nn"; if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') { $message .= HTTP_SERVER . DIR_WS_CATALOG . 'gv_redeem.php' . '/gv_no,'.$id1 . "nn"; } else { $message .= HTTP_SERVER . DIR_WS_CATALOG . 'gv_redeem.php' . '?gv_no='.$id1 . "nn"; } $message .= TEXT_OR_VISIT . HTTP_SERVER . DIR_WS_CATALOG . TEXT_ENTER_CODE; //Let's build a message object using the email class $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer')); // add the message to the object $mimemessage->add_text($message); $mimemessage->build_message(); $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', $from, $subject); // Now create the coupon main and email entry $insert_query = tep_db_query("insert into " . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $id1 . "', 'G', '" . $HTTP_POST_VARS['amount'] . "', now())"); $insert_id = tep_db_insert_id($insert_query); $insert_query = tep_db_query("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id ."', '0', 'Admin', '" . $mail['customers_email_address'] . "', now() )"); } if ($HTTP_POST_VARS['email_to']) { $id1 = create_coupon_code($HTTP_POST_VARS['email_to']); $message = tep_db_prepare_input($HTTP_POST_VARS['message']); $message .= "nn" . TEXT_GV_WORTH . $currencies->format($HTTP_POST_VARS['amount']) . "nn"; $message .= TEXT_TO_REDEEM; $message .= TEXT_WHICH_IS . $id1 . TEXT_IN_CASE . "nn"; $message .= HTTP_SERVER . DIR_WS_CATALOG . 'gv_redeem.php' . '?gv_no='.$id1 . "nn"; $message .= TEXT_OR_VISIT . HTTP_SERVER . DIR_WS_CATALOG . TEXT_ENTER_CODE; //Let's build a message object using the email class $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer')); // add the message to the object $mimemessage->add_text($message); $mimemessage->build_message(); $mimemessage->send('Friend', $HTTP_POST_VARS['email_to'], '', $from, $subject); // Now create the coupon email entry $insert_query = tep_db_query("insert into " . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $id1 . "', 'G', '" . $HTTP_POST_VARS['amount'] . "', now())"); $insert_id = tep_db_insert_id($insert_query); $insert_query = tep_db_query("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id ."', '0', 'Admin', '" . $HTTP_POST_VARS['email_to'] . "', now() )"); } tep_redirect(tep_href_link(FILENAME_GV_MAIL, 'mail_sent_to=' . urlencode($mail_sent_to))); } if ( ($HTTP_GET_VARS['action'] == 'preview') && (!$HTTP_POST_VARS['customers_email_address']) && (!$HTTP_POST_VARS['email_to']) ) { $messageStack->add(ERROR_NO_CUSTOMER_SELECTED, 'error'); } if ( ($HTTP_GET_VARS['action'] == 'preview') && (!$HTTP_POST_VARS['amount']) ) { $messageStack->add(ERROR_NO_AMOUNT_SELECTED, 'error'); } if ($HTTP_GET_VARS['mail_sent_to']) { $messageStack->add(sprintf(NOTICE_EMAIL_SENT_TO, $HTTP_GET_VARS['mail_sent_to']), 'notice'); } ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="2" cellpadding="2"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <?php if ( ($HTTP_GET_VARS['action'] == 'preview') && ($HTTP_POST_VARS['customers_email_address'] || $HTTP_POST_VARS['email_to']) ) { switch ($HTTP_POST_VARS['customers_email_address']) { case '***': $mail_sent_to = TEXT_ALL_CUSTOMERS; break; case '**D': $mail_sent_to = TEXT_NEWSLETTER_CUSTOMERS; break; default: $mail_sent_to = $HTTP_POST_VARS['customers_email_address']; if ($HTTP_POST_VARS['email_to']) { $mail_sent_to = $HTTP_POST_VARS['email_to']; } break; } ?> <tr><?php echo tep_draw_form('mail', FILENAME_GV_MAIL, 'action=send_email_to_user'); ?> <td><table border="0" width="100%" cellpadding="0" cellspacing="2"> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="smallText"><b><?php echo TEXT_CUSTOMER; ?></b><br><?php echo $mail_sent_to; ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="smallText"><b><?php echo TEXT_FROM; ?></b><br><?php echo htmlspecialchars(stripslashes($HTTP_POST_VARS['from'])); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="smallText"><b><?php echo TEXT_SUBJECT; ?></b><br><?php echo htmlspecialchars(stripslashes($HTTP_POST_VARS['subject'])); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="smallText"><b><?php echo TEXT_AMOUNT; ?></b><br><?php echo nl2br(htmlspecialchars(stripslashes($HTTP_POST_VARS['amount']))); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="smallText"><b><?php echo TEXT_MESSAGE; ?></b><br><?php echo nl2br(htmlspecialchars(stripslashes($HTTP_POST_VARS['message']))); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td> <?php /* Re-Post all POST'ed variables */ reset($HTTP_POST_VARS); while (list($key, $value) = each($HTTP_POST_VARS)) { if (!is_array($HTTP_POST_VARS[$key])) { echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value))); } } ?> <table border="0" width="100%" cellpadding="0" cellspacing="2"> <tr> <td><?php echo tep_image_submit('button_back.gif', IMAGE_BACK, 'name="back"'); ?></td> <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_GV_MAIL) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a> ' . tep_image_submit('button_send_mail.gif', IMAGE_SEND_EMAIL); ?></td> </tr> </table></td> </tr> </table></td> </form></tr> <?php } else { ?> <tr><?php echo tep_draw_form('mail', FILENAME_GV_MAIL, 'action=preview'); ?> <td><table border="0" cellpadding="0" cellspacing="2"> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <?php $customers = array(); $customers[] = array('id' => '', 'text' => TEXT_SELECT_CUSTOMER); $customers[] = array('id' => '***', 'text' => TEXT_ALL_CUSTOMERS); $customers[] = array('id' => '**D', 'text' => TEXT_NEWSLETTER_CUSTOMERS); $mail_query = tep_db_query("select customers_email_address, customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " order by customers_lastname"); while($customers_values = tep_db_fetch_array($mail_query)) { $customers[] = array('id' => $customers_values['customers_email_address'], 'text' => $customers_values['customers_lastname'] . ', ' . $customers_values['customers_firstname'] . ' (' . $customers_values['customers_email_address'] . ')'); } ?> <tr> <td class="main"><?php echo TEXT_CUSTOMER; ?></td> <td><?php echo tep_draw_pull_down_menu('customers_email_address', $customers, $HTTP_GET_VARS['customer']);?></td> </tr> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="main"><?php echo TEXT_TO; ?></td> <td><?php echo tep_draw_input_field('email_to'); ?><?php echo ' ' . TEXT_SINGLE_EMAIL; ?></td> </tr> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="main"><?php echo TEXT_FROM; ?></td> <td><?php echo tep_draw_input_field('from', EMAIL_FROM); ?></td> </tr> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="main"><?php echo TEXT_SUBJECT; ?></td> <td><?php echo tep_draw_input_field('subject'); ?></td> </tr> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td valign="top" class="main"><?php echo TEXT_AMOUNT; ?></td> <td><?php echo tep_draw_input_field('amount'); ?></td> </tr> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td valign="top" class="main"><?php echo TEXT_MESSAGE; ?></td> <td><?php echo tep_draw_textarea_field('message', 'soft', '60', '15'); ?></td> </tr> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td colspan="2" align="right"><?php echo tep_image_submit('button_send_mail.gif', IMAGE_SEND_EMAIL); ?></td> </tr> </table></td> </form></tr> <?php } ?> <!-- body_text_eof //--> </table></td> </tr> </table></td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> -- I really appreciate your stick-to-itiveness... Joe
  2. Hi Ian - The error occurs when we send out a gift voucher from the Admin section. Who knows, maybe we're distant cousins or something! Thanks!
  3. Ian, First of all, thank you very much for your contributions - weighing in at an average 3.93 posts-per-day in the left corner is Ian... ! I am running php v.4.3.1 and ms1 and have encountered the same problem that the people at greekretreat.com and that is that when I send out a voucher by email the total comes up to be $0.00 every time despite many efforts to lie, cheat and steal my way in! Foiled! This is the exact text in the email voucher: The Gift Voucher is worth $0.00 Simple as that, except I can't get it to work! Your help would be greatly appreciated. I tried to find your response to this question which was previously posted, but found no direct answer... ergo, this plead for help! Thanks again, Joe Wilson
×