AdmiralRedBeard Posted December 2, 2014 Share Posted December 2, 2014 Hi, I loaded the CCGV module for osC2.3.4. I can't send a gift voucher via e-mail either from my website or from my admin panel. It just clocks and ultimately times out. I can send a regular email from the admin panel. Can someone help me with this? ARB Quote Link to comment Share on other sites More sharing options...
AdmiralRedBeard Posted December 5, 2014 Author Share Posted December 5, 2014 Hi To add to my previous post, here is the error message that displays when trying to send a Gift Voucher via email. Fatal error: Maximum execution time of 30 seconds exceeded in /srv/disk2/951263/www/admiralredbeard.com/catalog/includes/functions/database.php on line 44 Here is line 44 from my database.php file: function tep_db_query($query, $link = 'db_link') { global $$link; <-- Line 44 if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) { error_log('QUERY: ' . $query . "\n", 3, STORE_PAGE_PARSE_TIME_LOG); } $result = mysqli_query($$link, $query) or tep_db_error($query, mysqli_errno($$link), mysqli_error($$link)); return $result; } Here are the contents to my gv_send.php file: <?php/* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2010 osCommerce Released under the GNU General Public License*/ require('includes/application_top.php'); require('includes/classes/http_client.php');// if the customer is not logged on, redirect them to the login page if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_GV_SEND); if (($_POST['back_x']) || ($_POST['back_y'])) { $_GET['action'] = ''; } if ($_GET['action'] == 'send') { $error = false; if (!tep_validate_email(trim($_POST['email']))) { $error = true; $error_email = ERROR_ENTRY_EMAIL_ADDRESS_CHECK; } $gv_query = tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'"); $gv_result = tep_db_fetch_array($gv_query); $customer_amount = $gv_result['amount']; $gv_amount = trim($_POST['amount']); if (preg_match('/^0-9/', $gv_amount)) { $error = true; $error_amount = ERROR_ENTRY_AMOUNT_CHECK; } if ($gv_amount>$customer_amount || $gv_amount == 0) { $error = true; $error_amount = ERROR_ENTRY_AMOUNT_CHECK; } } if ($_GET['action'] == 'process') { $id1 = create_coupon_code($mail['customers_email_address']); $gv_query = tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id='".$customer_id."'"); $gv_result = tep_db_fetch_array($gv_query); $new_amount = $gv_result['amount'] - $_POST['amount']; if ($new_amount < 0) { $error= true; $error_amount = ERROR_ENTRY_AMOUNT_CHECK; $_GET['action'] = 'send'; } else { $gv_query=tep_db_query("update " . TABLE_COUPON_GV_CUSTOMER . " set amount = '" . $new_amount . "' where customer_id = '" . $customer_id . "'"); $gv_query=tep_db_query("select customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'"); $gv_customer=tep_db_fetch_array($gv_query); $gv_query=tep_db_query("insert into " . TABLE_COUPONS . " (coupon_type, coupon_code, date_created, coupon_amount) values ('G', '" . $id1 . "', NOW(), '" . $_POST['amount'] . "')"); $insert_id = tep_db_insert_id(); $gv_query=tep_db_query("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, sent_lastname, emailed_to, date_sent) values ('" . $insert_id . "' ,'" . $customer_id . "', '" . addslashes($gv_customer['customers_firstname']) . "', '" . addslashes($gv_customer['customers_lastname']) . "', '" . $_POST['email'] . "', now())"); $gv_email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . sprintf(EMAIL_GV_TEXT_HEADER, $currencies->format($_POST['amount'])) . "\n" . EMAIL_SEPARATOR . "\n" . sprintf(EMAIL_GV_FROM, stripslashes($_POST['send_name'])) . "\n"; if (isset($_POST['message'])) { $gv_email .= EMAIL_GV_MESSAGE . "\n"; if (isset($_POST['to_name'])) { $gv_email .= sprintf(EMAIL_GV_SEND_TO, stripslashes($_POST['to_name'])) . "\n\n"; } $gv_email .= stripslashes($_POST['message']) . "\n\n"; } $gv_email .= sprintf(EMAIL_GV_REDEEM, $id1) . "\n\n"; $gv_email .= EMAIL_GV_LINK . tep_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $id1,'NONSSL',false);; $gv_email .= "\n\n"; $gv_email .= EMAIL_GV_FIXED_FOOTER . "\n\n"; $gv_email .= EMAIL_GV_SHOP_FOOTER . "\n\n";; $gv_email_subject = sprintf(EMAIL_GV_TEXT_SUBJECT, stripslashes($_POST['send_name'])); tep_mail('', $_POST['email'], $gv_email_subject, nl2br($gv_email), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, ''); } } $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_GV_SEND)); require(DIR_WS_INCLUDES . 'template_top.php');?><h1><?php echo HEADING_TITLE; ?></h1><div class="contentContainer"> <table border="0" width="100%" cellspacing="0" cellpadding="2"><?php if ($_GET['action'] == 'process') {?> <div class="contentText"> <p class="main"><?php echo TEXT_SUCCESS; ?><br><br><?php echo 'gv '.$id1; ?></p> </div> <div class="buttonSet"> <span class="buttonAction"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, null, tep_href_link(FILENAME_DEFAULT)); ?></span> </div><?php } if ($_GET['action'] == 'send' && !$error) { // validate entries $gv_amount = (double) $gv_amount; $gv_query = tep_db_query("select customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'"); $gv_result = tep_db_fetch_array($gv_query); $send_name = $gv_result['customers_firstname'] . ' ' . $gv_result['customers_lastname'];?><tr> <td><form action="<?php echo tep_href_link(FILENAME_GV_SEND, 'action=process', 'NONSSL'); ?>" method="post"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><?php echo sprintf(MAIN_MESSAGE, $currencies->format($_POST['amount']), stripslashes($_POST['to_name']), $_POST['email'], stripslashes($_POST['to_name']), $currencies->format($_POST['amount']), $send_name); ?></td> </tr><?php if ($_POST['message']) {?> <tr> <td class="main"><?php echo sprintf(PERSONAL_MESSAGE, $gv_result['customers_firstname']); ?></td> </tr> <tr> <td class="main"><?php echo stripslashes($_POST['message']); ?></td> </tr><?php } echo tep_draw_hidden_field('send_name', $send_name) . tep_draw_hidden_field('to_name', stripslashes($_POST['to_name'])) . tep_draw_hidden_field('email', $_POST['email']) . tep_draw_hidden_field('amount', $gv_amount) . tep_draw_hidden_field('message', stripslashes($_POST['message']));?> <tr> <td class="main"><?php echo tep_image_submit('button_back.gif', IMAGE_BUTTON_BACK, 'name=back') . '</a>'; ?></td> <td align="right"><br><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, null, null, 'primary'); ?></td> </tr> </table></form></td> </tr><?php } elseif ($_GET['action']=='' || $error) {?> <tr> <td class="main"><?php echo HEADING_TEXT; ?></td> </tr> <tr> <td><form action="<?php echo tep_href_link(FILENAME_GV_SEND, 'action=send', 'NONSSL'); ?>" method="post"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><?php echo ENTRY_NAME; ?><br><?php echo tep_draw_input_field('to_name', stripslashes($_POST['to_name']));?></td> </tr> <tr> <td class="main"><?php echo ENTRY_EMAIL; ?><br><?php echo tep_draw_input_field('email', $_POST['email']); if ($error) echo $error_email; ?></td> </tr> <tr> <td class="main"><?php echo ENTRY_AMOUNT; ?><br><?php echo tep_draw_input_field('amount', $_POST['amount'], '', '', false); if ($error) echo $error_amount; ?></td> </tr> <tr> <td class="main"><?php echo ENTRY_MESSAGE; ?><br><?php echo tep_draw_textarea_field('message', 'soft', 50, 15, stripslashes($_POST['message'])); ?></td> </tr> </table> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr><?php $back = sizeof($navigation->path)-2;?> <td class="main"><?php echo tep_draw_button(IMAGE_BUTTON_BACK, null, tep_href_link(FILENAME_ACCOUNT, '', 'SSL')); ?></td> <td class="main" align="right"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, null, null, 'primary'); ?></td> </tr> </table></form></td> </tr><?php }?></table></div><?php require(DIR_WS_INCLUDES . 'template_bottom.php'); require(DIR_WS_INCLUDES . 'application_bottom.php');?> Quote Link to comment Share on other sites More sharing options...
lovarano Posted January 26, 2015 Share Posted January 26, 2015 Hi all, all my other mails are send with Ultimate Emails contribution. I would like to intstall it on CCGV too. However, I have no idea, because the gv_mail.php in admin is a different code as e.g. create_account.php What I did until yet. I created a template in Ultimate Emails folder and language file. But, where I have to put the linking part for U. Mails, in the following codes in gv_mail exactly? <?php/* $Id: gv_mail.php, v2.3.3.4 22:54:01 mommaroodles Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2014 osCommerce Released under the GNU General Public License*/ require('includes/application_top.php'); require(DIR_WS_CLASSES . 'currencies.php'); $currencies = new currencies(); $action = (isset($_GET['action']) ? $_GET['action'] : ''); if ( ($action == 'send_email_to_user') && isset($_POST['customers_email_address']) && !isset($_POST['back_x']) ) { switch ($_POST['customers_email_address']) { case '***': $mail_query = tep_db_query("select customers_id, 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_id, 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($_POST['customers_email_address']); $mail_query = tep_db_query("select customers_id, customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($customers_email_address) . "'"); $mail_sent_to = $_POST['customers_email_address']; break; } // create a coupon code from customers email address $id1 = create_coupon_code($mail['customers_email_address']); $from = tep_db_prepare_input($_POST['from']); $subject = tep_db_prepare_input($_POST['subject']); $amount = tep_db_prepare_input($_POST['amount']); while ($mail = tep_db_fetch_array($mail_query)) { $customers_id = $mail['customers_id']; $customers_name = $mail['customers_firstname'] . ' ' . $mail['customers_lastname']; $message .= 'Liebe® ' . $customers_name . "\n\n"; $message .= TEXT_GV_WORTH ."\n\n"; $message .= $currencies->format($_POST['amount']). "\n\n"; $message .= TEXT_TO_REDEEM . TEXT_ENTER_CODE ."\n\n"; $message .= TEXT_WHICH_IS . $id1 . "\n\n"; $message .= TEXT_OR_VISIT . HTTP_SERVER . DIR_WS_CATALOG . "\n\n"; $message .= TEXT_SIGN_OFF . "\n\n"; //Let's build a message object using the email class $mimemessage = new email(array('X-Mailer: osCommerce')); // Build the text version $text = strip_tags($message); if (EMAIL_USE_HTML == 'true') { $mimemessage->add_html($message, $text); } else { $mimemessage->add_text($text); } $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 $coupon_id = tep_db_insert_id(); tep_db_query("insert into " . TABLE_COUPONS . " (coupon_id, coupon_code, coupon_type, coupon_amount, coupon_status, date_created) values ('" . (int)$coupon_id . "','" . $id1 . "', 'G', '" . $_POST['amount'] . "', '1', now() )"); $coupon_id = tep_db_insert_id(); tep_db_query("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, sent_lastname, emailed_to, date_sent) values ('" . (int)$coupon_id . "', '". $mail['customers_id'] . "', '" . $mail['customers_firstname'] . "', '" . $mail['customers_lastname'] . "', '" . $mail['customers_email_address'] . "', now() )");} tep_redirect(tep_href_link(FILENAME_GV_MAIL, 'mail_sent_to=' . urlencode($mail_sent_to))); } if ( ($_GET['action'] == 'preview') && (!$_POST['customers_email_address']) ) { $messageStack->add(ERROR_NO_CUSTOMER_SELECTED, 'error'); } if ( ($action == 'preview') && (!$_POST['amount']) ) { $messageStack->add(ERROR_NO_AMOUNT_SELECTED, 'error'); } if ($_GET['mail_sent_to']) { $messageStack->add(sprintf(NOTICE_EMAIL_SENT_TO, $_GET['mail_sent_to']), 'success'); } require(DIR_WS_INCLUDES . 'template_top.php');?> <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"></td> </tr> </table></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"><?php if ( ($action == 'preview') && isset($_POST['customers_email_address']) ) { switch ($_POST['customers_email_address']) { case '***': $mail_sent_to = TEXT_ALL_CUSTOMERS; break; case '**D': $mail_sent_to = TEXT_NEWSLETTER_CUSTOMERS; break; default: $mail_sent_to = $_POST['customers_email_address']; 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"><strong><?php echo TEXT_CUSTOMER; ?></strong><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"><strong><?php echo TEXT_FROM; ?></strong><br><?php echo htmlspecialchars(stripslashes($_POST['from'])); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="smallText"><strong><?php echo TEXT_SUBJECT; ?></strong><br><?php echo htmlspecialchars(stripslashes($_POST['subject'])); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="smallText"><strong><?php echo TEXT_AMOUNT; ?></strong><br><?php echo htmlspecialchars(stripslashes($_POST['amount'])); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="smallText"><strong><?php echo TEXT_MESSAGE; ?></strong><br><?php echo nl2br(htmlspecialchars(stripslashes($_POST['message']))); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="smallText" align="right"><?php/* Re-Post all POST'ed variables */ reset($_POST); while (list($key, $value) = each($_POST)) { if (!is_array($_POST[$key])) { echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value))); } } echo tep_draw_button(IMAGE_SEND_EMAIL, 'mail-closed', null, 'primary') . tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link(FILENAME_GV_MAIL));?> </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, (isset($_GET['customer']) ? $_GET['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_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 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> <!-- herausgenommen <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 class="smallText" colspan="2" align="right"><?php echo tep_draw_button(IMAGE_PREVIEW, 'document', null, 'primary'); ?></td> </tr> </table></td> </form></tr><?php }?> </table></td> </tr> </table><?php require(DIR_WS_INCLUDES . 'template_bottom.php'); require(DIR_WS_INCLUDES . 'application_bottom.php');?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.