Irin Posted January 4, 2016 Posted January 4, 2016 I have a problem with receiving order confirmation emails both, customer and admin side. All the other email features work fine: contact us form, new customer sign up, send e-mail from Admin panel. Any ideas why?I have the following configuration: osc v2.3.4admin/configuration/my storeE-Mail Address: store@@Domain.comE-Mail From: store@@Domain.comSend Extra Order Emails To: store@@Domain.comadmin/configuration/E-Mail OptionsE-Mail Transport Method: sendmailE-Mail Linefeeds: LFUse MIME HTML When Sending Emails: trueVerify E-Mail Addresses Through DNS: falseSend E-Mails: truePlease help.
♥ecartz Posted January 5, 2016 Posted January 5, 2016 Have you tried http://addons.oscommerce.com/info/1595 That script should test if your server supports sending emails in PHP. If it doesn't send emails when installed as per the directions, then it's not an osCommerce issue. Note: it won't fix your problem. It's a diagnostic tool. Always back up before making changes.
Irin Posted January 5, 2016 Author Posted January 5, 2016 Hi, Matt. I've just tried the script that you recommended, thank you. I do get both emails: one using the native PHP mail function, and a second email using the osCommerce email class. Where should I look next? Thanks.
Irin Posted January 7, 2016 Author Posted January 7, 2016 Can anybody give any ideas on this issue? Thanks.
AlexanderNick Posted January 7, 2016 Posted January 7, 2016 How long ago did this happen?Probably should examine the file checkout_process.php
Irin Posted January 7, 2016 Author Posted January 7, 2016 The problem just started a month ago. The checkout_process.php file seems to be formatted correctly.
AlexanderNick Posted January 8, 2016 Posted January 8, 2016 If you provide access to the site or files, I can see.
burt Posted January 8, 2016 Posted January 8, 2016 Please do not give access details to your site to anyone except a well trusted (by you) developer.
Irin Posted January 8, 2016 Author Posted January 8, 2016 If you provide access to the site or files, I can see. Thanks for trying to help, Alexander. I understand that it's hard to figure out what's wrong without having a full access to the site/files. Unfortunately, I can't provide either of that due to the privacy of my customers' personal information. Please understand. Although, I can provide the configuration information or any specific file code here, in the forum, if you think that it'll help solving the problem. Thank you!
AlexanderNick Posted January 8, 2016 Posted January 8, 2016 I understand.1You can see how to implement sending emails in the file contact_us.php and compare with checkout_process.php.contact_us.phptep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);checkout_process.php tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);// send emails to other people if (SEND_EXTRA_ORDER_EMAILS_TO != '') { tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); } Make sure that the program reaches this linecheckout_process.php tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);2Check valid email address in $order->customer['email_address'] and SEND_EXTRA_ORDER_EMAILS_TO in runtime.3Also check error log.Perhaps there is an error on checkout_process.php, and the letter can not be sent.4Check send email via native PHP mail() function.checkout_process.php if (SEND_EXTRA_ORDER_EMAILS_TO != '') {replace to mail('YOUR EMAIL ADDRESS', EMAIL_TEXT_SUBJECT, $email_order); if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
Irin Posted January 8, 2016 Author Posted January 8, 2016 1. The sending emails code in my checkout_process.php file is a little bit different from the original, provided by osc. Here it is: tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], STORE_NAME . ' ' . EMAIL_TEXT_SUBJECT_1 . '' . $insert_id . ' ' . EMAIL_TEXT_SUBJECT_2, $email_order, STORE_NAME, STORE_OWNER_EMAIL_ADDRESS); //store order number in insert_id for mime export. $insert_id = $order_id; // send emails to other people if (SEND_EXTRA_ORDER_EMAILS_TO != '') { // BOF Admin Email Print Invoice $email_order .= 'Print Invoice: '. "<a href='" .tep_href_link(FILENAME_INVOICE_PRINT, 'oID=' . $insert_id, 'SSL') . "'>" . 'order_id = ' . $insert_id . "</a>\n"; // EOF Admin Email Print Invoice tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, STORE_NAME . ' ' . EMAIL_TEXT_SUBJECT_1 . '' . $insert_id . ' ' . EMAIL_TEXT_SUBJECT_2, $email_order, $order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address']); } 2. Both emails are valid. 3. I'm not sure what error log do you refer to. Please specify. 4. I've tried using the script from http://addons.oscommerce.com/info/1595add-on, and I do get both emails: one using the native PHP mail function, and a second email using the osCommerce email class.
AlexanderNick Posted January 8, 2016 Posted January 8, 2016 I am confused by this line.$insert_id = $order_id;Try to comment this line.//$insert_id = $order_id; Can you show the full file checkout_process.php?
Irin Posted January 8, 2016 Author Posted January 8, 2016 My checkout_process.php file is modified with various add-ons and can be complicated to understand without viewing additional files. $insert_id is most likely used by one of the add-ons to show order id in the order confirmation email. Here is my full checkout_process.php: <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2007 osCommerce Released under the GNU General Public License */ include('includes/application_top.php'); $ip = $HTTP_SERVER_VARS["REMOTE_ADDR"]; $client = gethostbyaddr($HTTP_SERVER_VARS["REMOTE_ADDR"]); $str = preg_split("/\./", $client); $i = count($str); $x = $i - 1; $n = $i - 2; $isp = $str[$n] . "." . $str[$x]; //mod to set payment to default currency $currency = DEFAULT_CURRENCY; // if the customer is not logged on, redirect them to the login page if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT)); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } // if there is nothing in the customers cart, redirect them to the shopping cart page if ($cart->count_contents() < 1) { tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); } // if no shipping method has been selected, redirect the customer to the shipping method selection page if (!tep_session_is_registered('shipping') || !tep_session_is_registered('sendto')) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); } if ( (tep_not_null(MODULE_PAYMENT_INSTALLED)) && (!tep_session_is_registered('payment')) ) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); } // avoid hack attempts during the checkout procedure by checking the internal cartID if (isset($cart->cartID) && tep_session_is_registered('cartID')) { if ($cart->cartID != $cartID) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); } } include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PROCESS); // load selected payment module require(DIR_WS_CLASSES . 'payment.php'); /* CCGV - BEGIN */ if ($credit_covers) $payment=''; $payment_modules = new payment($payment); /* CCGV - END */ // load the selected shipping module require(DIR_WS_CLASSES . 'shipping.php'); $shipping_modules = new shipping($shipping); require(DIR_WS_CLASSES . 'order.php'); $order = new order; // Stock Check $any_out_of_stock = false; if (STOCK_CHECK == 'true') { for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { if (tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty'])) { $any_out_of_stock = true; } } // Out of Stock if ( (STOCK_ALLOW_CHECKOUT != 'true') && ($any_out_of_stock == true) ) { tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); } } $any_bundle_only = false; $products = $cart->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { if ($products[$i]['sold_in_bundle_only'] == 'yes') $any_bundle_only = true; } if ($any_bundle_only) tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); $payment_modules->update_status(); /* CCGV - BEGIN */ if (((is_array($payment_modules->modules)) && (sizeof($payment_modules->modules) > 1) && (!is_object($$payment)) && (!$credit_covers)) || ( (is_object($$payment)) && ($$payment->enabled == false) ) ) { /* CCGV - END */ tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL')); } require(DIR_WS_CLASSES . 'order_total.php'); $order_total_modules = new order_total; $order_totals = $order_total_modules->process(); if ($order->info['payment_method'] == 'Purchase Order Account') { $check_credit = tep_db_query("select customers_credit_left from " . TABLE_CUSTOMERS . " where customers_id ='" . $customer_id . "'"); $credit = tep_db_fetch_array($check_credit); $subamt = $credit['customers_credit_left'] - $order->info['total']; $credit_tot = tep_db_query("select customers_credit_amount from " . TABLE_CUSTOMERS . " where customers_id ='" . $customer_id . "'"); $credit_tot = tep_db_fetch_array($credit_tot); $credit_amount = $credit_tot['customers_credit_amount']; tep_db_query("update " . TABLE_CUSTOMERS . " set customers_credit_left ='" . $subamt . "' where customers_id = '" . $customer_id . "'"); } // load the before_process function from the payment modules $payment_modules->before_process(); $sql_data_array = array('customers_id' => $customer_id, 'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'], 'customers_company' => $order->customer['company'], 'customers_street_address' => $order->customer['street_address'], 'customers_suburb' => $order->customer['suburb'], 'customers_city' => $order->customer['city'], 'customers_postcode' => $order->customer['postcode'], 'customers_state' => $order->customer['state'], 'customers_country' => $order->customer['country']['title'], 'customers_telephone' => $order->customer['telephone'], 'customers_email_address' => $order->customer['email_address'], 'customers_address_format_id' => $order->customer['format_id'], // BEGIN - Tax Exempt and Organization Discounts 'customers_tax_exempt' => $order->customer['tax_exempt'], 'customers_tax_exempt_id' => $order->customer['tax_exempt_id'], 'customers_org_type' => $order->customer['org_type'], // END - Tax Exempt and Organization Discounts 'delivery_name' => trim($order->delivery['firstname'] . ' ' . $order->delivery['lastname']), 'delivery_company' => $order->delivery['company'], 'delivery_street_address' => $order->delivery['street_address'], 'delivery_suburb' => $order->delivery['suburb'], 'delivery_city' => $order->delivery['city'], 'delivery_postcode' => $order->delivery['postcode'], // BOF Collect Residential/Commercial info for shipping 'delivery_residence_id' => $order->delivery['residence_id'], // EOF Collect Residential/Commercial info for shipping 'delivery_state' => $order->delivery['state'], 'delivery_country' => $order->delivery['country']['title'], 'delivery_address_format_id' => $order->delivery['format_id'], 'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'], 'billing_company' => $order->billing['company'], 'billing_street_address' => $order->billing['street_address'], 'billing_suburb' => $order->billing['suburb'], 'billing_city' => $order->billing['city'], 'billing_postcode' => $order->billing['postcode'], 'billing_state' => $order->billing['state'], 'billing_country' => $order->billing['country']['title'], 'billing_address_format_id' => $order->billing['format_id'], 'payment_method' => $order->info['payment_method'], 'shipping_module' => $shipping['id'] , 'cc_type' => $order->info['cc_type'], 'cc_owner' => $order->info['cc_owner'], 'cc_number' => $order->info['cc_number'], 'cc_expires' => $order->info['cc_expires'], 'date_purchased' => 'now()', 'orders_status' => $order->info['order_status'], // Company PO Account start 'purchase_order_number' => $order->info['po_number'], 'customers_credit_left' => $subamt, 'customers_credit_amount' => $credit_amount, // Company PO Account end 'currency' => $order->info['currency'], 'currency_value' => $order->info['currency_value'], 'customers_referer_url' => $referer_url, 'ipaddy' => $ip, 'ipisp' => $isp); tep_db_perform(TABLE_ORDERS, $sql_data_array); $insert_id = tep_db_insert_id(); for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) { $sql_data_array = array('orders_id' => $insert_id, 'title' => $order_totals[$i]['title'], 'text' => $order_totals[$i]['text'], 'value' => $order_totals[$i]['value'], 'class' => $order_totals[$i]['code'], 'sort_order' => $order_totals[$i]['sort_order']); tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array); } $customer_notification = (SEND_EMAILS == 'true') ? '1' : '0'; $sql_data_array = array('orders_id' => $insert_id, 'orders_status_id' => $order->info['order_status'], 'date_added' => 'now()', 'customer_notified' => $customer_notification, 'comments' => $order->info['comments']); tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array); // initialized for the email confirmation $products_ordered = ''; // begin product bundles function reduce_bundle_stock($bundle_id, $qty_sold) { $bundle_query = tep_db_query('select pb.subproduct_id, pb.subproduct_qty, p.products_bundle, p.products_quantity from ' . TABLE_PRODUCTS_BUNDLES . ' pb, ' . TABLE_PRODUCTS . ' p where p.products_id = pb.subproduct_id and bundle_id = ' . (int)tep_get_prid($bundle_id)); while ($bundle_info = tep_db_fetch_array($bundle_query)) { if ($bundle_info['products_bundle'] == 'yes') { reduce_bundle_stock($bundle_info['subproduct_id'], ($qty_sold * $bundle_info['subproduct_qty'])); // update quantity of nested bundle sold tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', ($qty_sold * $bundle_info['subproduct_qty'])) . " where products_id = " . (int)$bundle_info['subproduct_id']); } else { $bundle_stock_left = $bundle_info['products_quantity'] - ($qty_sold * $bundle_info['subproduct_qty']); tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = " . (int)$bundle_stock_left . ", products_ordered = products_ordered + " . (int)($qty_sold * $bundle_info['subproduct_qty']) . " where products_id = " . (int)$bundle_info['subproduct_id']); if ( ($bundle_stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) { tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = " . (int)$bundle_info['subproduct_id']); } } } } for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { // Stock Update - Joao Correia if (STOCK_LIMITED == 'true') { if (DOWNLOAD_ENABLED == 'true') { $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename, products_bundle FROM " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa ON p.products_id=pa.products_id LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad ON pa.products_attributes_id=pad.products_attributes_id WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"; // Will work with only one option for downloadable products // otherwise, we have to build the query dynamically with a loop $products_attributes = (isset($order->products[$i]['attributes'])) ? $order->products[$i]['attributes'] : ''; if (is_array($products_attributes)) { $stock_query_raw .= " AND pa.options_id = '" . (int)$products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . (int)$products_attributes[0]['value_id'] . "'"; } $stock_query = tep_db_query($stock_query_raw); } else { $stock_query = tep_db_query("select products_quantity, products_bundle from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); } if (tep_db_num_rows($stock_query) > 0) { $stock_values = tep_db_fetch_array($stock_query); // do not decrement quantities if products_attributes_filename exists if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) { if ($stock_values['products_bundle'] == 'yes') { reduce_bundle_stock($order->products[$i]['id'], $order->products[$i]['qty']); $stock_left = 1; // products_quantity has no meaning for bundles but must be at least one for bundle to sell, bundle quantity check is done by other means } else { $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty']; } } else { $stock_left = $stock_values['products_quantity']; } tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . (int)$stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) { tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); } } } // end product bundles // Update products_ordered (for bestsellers list) tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); $sql_data_array = array('orders_id' => $insert_id, 'products_id' => tep_get_prid($order->products[$i]['id']), 'products_model' => $order->products[$i]['model'], 'products_name' => $order->products[$i]['name'], 'products_price' => $order->products[$i]['price'], 'final_price' => $order->products[$i]['final_price'], 'products_tax' => $order->products[$i]['tax'], // BEGIN - Tax Exempt and Organization Discounts 'products_eligible_discounts' => $order->products[$i]['eligible_discounts'], 'products_education_discount' => $order->products[$i]['education_discount'], 'products_government_discount' => $order->products[$i]['government_discount'], 'products_gsa_pricing' => $order->products[$i]['gsa_pricing'], // END - Tax Exempt and Organization Discounts 'products_quantity' => $order->products[$i]['qty']); tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array); $order_products_id = tep_db_insert_id(); //begin add receipt// tep_session_register('last_order'); $last_order = $insert_id; $oID = $last_order; //end add receipt// /* CCGV - BEGIN */ $order_total_modules->update_credit_account($i,$insert_id); /* CCGV - END */ //------insert customer choosen option to order-------- $attributes_exist = '0'; $products_ordered_attributes = ''; if (isset($order->products[$i]['attributes'])) { $attributes_exist = '1'; for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) { if (DOWNLOAD_ENABLED == 'true') { $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad on pa.products_attributes_id=pad.products_attributes_id where pa.products_id = '" . (int)$order->products[$i]['id'] . "' and pa.options_id = '" . (int)$order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int)$languages_id . "' and poval.language_id = '" . (int)$languages_id . "'"; $attributes = tep_db_query($attributes_query); } else { $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . (int)$order->products[$i]['id'] . "' and pa.options_id = '" . (int)$order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int)$languages_id . "' and poval.language_id = '" . (int)$languages_id . "'"); } // BEGIN - Tax Exempt and Organization Discounts if (tep_db_num_rows($attributes)) { // END - Tax Exempt and Organization Discounts $attributes_values = tep_db_fetch_array($attributes); $sql_data_array = array('orders_id' => $insert_id, 'orders_products_id' => $order_products_id, 'products_options' => $attributes_values['products_options_name'], 'products_options_values' => $order->products[$i]['attributes'][$j]['value'], 'options_values_price' => $attributes_values['options_values_price'], 'price_prefix' => $attributes_values['price_prefix']); tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array); if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values['products_attributes_filename']) && tep_not_null($attributes_values['products_attributes_filename'])) { $sql_data_array = array('orders_id' => $insert_id, 'orders_products_id' => $order_products_id, 'orders_products_filename' => $attributes_values['products_attributes_filename'], 'download_maxdays' => $attributes_values['products_attributes_maxdays'], 'download_count' => $attributes_values['products_attributes_maxcount']); tep_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array); } $products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . tep_decode_specialchars($order->products[$i]['attributes'][$j]['value']); // BEGIN - Tax Exempt and Organization Discounts } if ($order->products[$i]['attributes'][$j]['option_id'] = "organization_discount") { $sql_data_array = array('orders_id' => $insert_id, 'orders_products_id' => $order_products_id, 'products_options' => $order->products[$i]['attributes'][$j]['option'], 'products_options_values' => $order->products[$i]['attributes'][$j]['value'], 'options_values_price' => $order->products[$i]['attributes'][$j]['price'], 'price_prefix' => $order->products[$i]['attributes'][$j]['prefix']); tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array); } // END - Tax Exempt and Organization Discounts } } //------insert customer choosen option eof ---- $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n"; } /* CCGV - BEGIN */ $order_total_modules->apply_credit(); /* CCGV - END */ // lets start with the email confirmation // START HTML Invoice if (EMAIL_INVOICE == 'true') { require(DIR_WS_MODULES . EMAIL_INVOICE_DIR . FILENAME_EMAIL_INVOICE); } else { // END HTML Invoice $email_order = 'Dear ' . $order->customer['firstname'] . ' ' . $order->customer['lastname'] . ',' . "\n" . EMAIL_SEPARATOR . "\n" . ORDER_PROCESS_EMAIL_TEXT . "\n" . EMAIL_SEPARATOR . "\n" . STORE_NAME . ' ' . EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . "<a href='" . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "'>" . 'order_id = ' . $insert_id . "</a>\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG, strtotime($date_time)) . "\n\n"; if ($order->info['comments']) { $email_order .= 'Comments: ' . tep_db_output($order->info['comments']) . "\n\n"; } $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $products_ordered . EMAIL_SEPARATOR . "\n"; for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) { $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n"; } if ($order->content_type != 'virtual') { $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n"; } $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n"; if (is_object($$payment)) { $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n"; $payment_class = $$payment; $email_order .= $order->info['payment_method'] . "\n\n"; EMAIL_TEXT_ORDER_STATUS . ' ' . "<a href='" . tep_href_link(FILENAME_ACCOUNT_HISTORY, 'order_id=' . $insert_id, 'SSL') . "'>" . (EMAIL_TEXT_ORDER_STATUS_LINK) . "</a>\n\n\n"; if (isset($payment_class->email_footer)) { $email_order .= $payment_class->email_footer . "\n\n"; // Company PO Account start if($order->info['purchase_order_number']) { $email_order .= EMAIL_TEXT_PURCHASE_ORDER_NUMBER . ' ' . $order->info['purchase_order_number'] . "\n"; } // Company PO Account end } } tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], STORE_NAME . ' ' . EMAIL_TEXT_SUBJECT_1 . '' . $insert_id . ' ' . EMAIL_TEXT_SUBJECT_2, $email_order, STORE_NAME, STORE_OWNER_EMAIL_ADDRESS); //store order number in insert_id for mime export. $insert_id = $order_id; // send emails to other people if (SEND_EXTRA_ORDER_EMAILS_TO != '') { // BOF Admin Email Print Invoice $email_order .= 'Print Invoice: '. "<a href='" .tep_href_link(FILENAME_INVOICE_PRINT, 'oID=' . $insert_id, 'SSL') . "'>" . 'order_id = ' . $insert_id . "</a>\n"; // EOF Admin Email Print Invoice tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, STORE_NAME . ' ' . EMAIL_TEXT_SUBJECT_1 . '' . $insert_id . ' ' . EMAIL_TEXT_SUBJECT_2, $email_order, $order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address']); } // START HTML Invoice } // END HTML Invoice // load the after_process function from the payment modules $payment_modules->after_process(); // remove items from wishlist if customer purchased them $wishList->clear(); $cart->reset(true); // unregister session variables used during checkout tep_session_unregister('sendto'); tep_session_unregister('billto'); tep_session_unregister('shipping'); tep_session_unregister('shipping_quotes'); tep_session_unregister('payment'); tep_session_unregister('comments'); // MOD: BOF - SmartSuggest BEGIN if (SMARTSUGGEST_ENABLED == 'true' && SMARTSUGGEST_RECORD_KEYWORDS == 'true') { if (tep_session_is_registered('searched_keywords_id')) { tep_db_perform(TABLE_SEARCHED_KEYWORDS, array('customers_id' => (int)$customer_id, 'orders_id' => (int)$insert_id), 'update', "searched_keywords_id = '" . (int)$searched_keywords_id . "'"); tep_session_unregister('searched_keywords_id'); } } // MOD: EOF - SmartSuggest END /* CCGV - BEGIN */ if(tep_session_is_registered('credit_covers')) tep_session_unregister('credit_covers'); $order_total_modules->clear_posts(); /* CCGV - END */ tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL')); require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
AlexanderNick Posted January 8, 2016 Posted January 8, 2016 Too many add-ons.Identify the problem cannot without viewing other files.
Irin Posted January 8, 2016 Author Posted January 8, 2016 I checked my current checkout_process.php file against the working backup copy, and they are completely the same, so I'm assuming that the problem is hiding somewhere else.
AlexanderNick Posted January 8, 2016 Posted January 8, 2016 Yes. But I cannot identify where without all files and database.
Jack_mcs Posted January 9, 2016 Posted January 9, 2016 This is a common problem with the html emails addon. Sometimes it is due to not being installed/setup correctly but it can also be due to the version you are using. See if there is a setting in your admin for using the email invoice addon. I don't recall where it is off the top of my head but it is in admin->Configuration, probably in its own section. If that is true, set it to false and see if the problem is fixed. If you can't find it or set it to off doesn't help, find this code in the checkout_process.php file // START HTML Invoice if (EMAIL_INVOICE == 'true') { require(DIR_WS_MODULES . EMAIL_INVOICE_DIR . FILENAME_EMAIL_INVOICE); } else { // END HTML Invoice and change it to this // START HTML Invoice // if (EMAIL_INVOICE == 'true') { // require(DIR_WS_MODULES . EMAIL_INVOICE_DIR . FILENAME_EMAIL_INVOICE); //} else { { // END HTML Invoice The above isn't a proper fix but it should get the emails working if this is the problem. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
Irin Posted January 10, 2016 Author Posted January 10, 2016 Hi, Jack. Thanks for your advice. I tried to set 'Send HTML or Text Invoices to Customers' and 'Use MIME HTML When Sending Emails' in admin->Configuration->E-Mail Options to false, with no success. I also tried your second advice, but no success either. I think this means that the email invoice add-on works fine, and the problem is somewhere else.
Jack_mcs Posted January 10, 2016 Posted January 10, 2016 If the only place where email doesn't is with orders then the cause is almost certainly in the checkout_process.php file. I suggest replacing that file with a stock one for a quick test. If the email works then it is something in that file or something it calls. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
Irin Posted January 10, 2016 Author Posted January 10, 2016 Hi, Jack. I replaced my checkout_process.php with the original osc v2.3.4, just like you suggested, but the emails are still not sent.
Jack_mcs Posted January 11, 2016 Posted January 11, 2016 That doesn't make any sense to me. The problem appears to be a coding problem but you have basically replaced all of the code - strange. Try this first. Near the top of the checkout_process.php file, find this line include('includes/application_top.php'); And add this after it ini_set('display_errors','1'); Then try an order and see if any errors are displayed. If that doesn't help, find the line that starts with tep_mail($order->customer['firstname' and add this before it echo 'msg '.$email_order; die; If that works, it will display a message on the page. Be sure to remove it right away since it will break your checkout. If the message is displayed, see if it is correct. If it doesn't display, then something is stopping the code from reaching the email part of the code. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
Irin Posted January 11, 2016 Author Posted January 11, 2016 Neither, enabling display errors nor adding the lines to the checkout_process.php file displayed any errors or messages. The order was completed successfully, but not emails were sent.
Jack_mcs Posted January 11, 2016 Posted January 11, 2016 Then your code is bypassing the email code for some reason. The die command means just what it says and will cause the code to die when it is reached. Since that didn't happen, the code was never reached. A brute-force approach would be to move that statement up in the code until it causes a failure. If it causes a failure then the problem area in the code is between those two locations. But for a quick test I suggest placing the die statement right after the 'includes/application_top.php' line. It is possible that something in the code is redirecting to a different file and the one you are working on is not even being loaded. By placing the statement after that first includes statement, it has to die if that file is being called. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
Irin Posted January 11, 2016 Author Posted January 11, 2016 It did die indeed when I placed the statement right after the 'includes/application_top.php' line. All it shows on the checkout_process.php is 'msg'.
Jack_mcs Posted January 11, 2016 Posted January 11, 2016 Then the problem is between there and the original location the die was at. Find this code if (EMAIL_INVOICE == 'true') { require(DIR_WS_MODULES . EMAIL_INVOICE_DIR . FILENAME_EMAIL_INVOICE); } else { and change it to if (false) { require(DIR_WS_MODULES . EMAIL_INVOICE_DIR . FILENAME_EMAIL_INVOICE); } else { die; Be sure to remove the other changes you made. If the page dies, then remove only the die; line (leave the other change) and try an order to see if it works. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
Recommended Posts
Archived
This topic is now archived and is closed to further replies.