Oitsuki Posted March 10, 2003 Share Posted March 10, 2003 Hello, I am developped a little code for the oscommerce in checkout_process (i don't like the e mail reception by original oscommerce). It allows to send a command by a html mail at the customers or by extra e mail. There the code : //------insert customer choosen option eof ---- $total_weight += ($order->products[$i]['qty'] * $order->products[$i]['weight']); $total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty']; $total_cost += $total_products_price; // ########### Added E Mail customization ############ $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"; $products_quantity .= nl2br($order->products[$i]['qty'] . "n"); $products_name .= nl2br("" . $order->products[$i]['name'] . $products_ordered_attributes ."n"); $products_model .= nl2br($order->products[$i]['model'] . "n"); $products_price .= nl2br($currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty']) . "n"); } // Changed // lets start with the email confirmation // $email_order = STORE_NAME . "n" . // EMAIL_SEPARATOR . "n" . // EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "n" . // EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "n" . // EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "nn"; if ($order->info['comments']) { $email_order .= tep_db_output($order->info['comments']) . "nn"; } // $email_order .= EMAIL_TEXT_PRODUCTS . "n" . // EMAIL_SEPARATOR . "n" . // $products_ordered . // EMAIL_SEPARATOR . "n"; $size = sizeof($order_totals); for ($i=0; $i<$size; $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") . "nn"; if (is_object($$payment)) { $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "n" . // EMAIL_SEPARATOR . "n"; $payment_class = $$payment; $email_order .= $payment_class->title . "nn"; if ($payment_class->email_footer) { // $email_order .= $payment_class->email_footer . "nn"; } } // tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, nl2br($email_order), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, ''); // #################### Added customization e mail order #################### $email_order = ' <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <?php <title><?php echo TITLE ?></title> <base href="' . HTTP_SERVER . DIR_WS_CATALOG . '"> <link rel="stylesheet" type="text/css" href="stylesheet1.css"> </head> <body> <div align="center"> <center> <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="550" id="AutoNumber1"> <tr> <td width="100%"><a href="' . HTTP_SERVER . DIR_WS_CATALOG . '"><IMG src="'. HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . '/infobox/headerbg.jpg" border=0></a></td> </tr> </table> </center> </div> <p> </p> <DIV align=center> <TABLE cellSpacing=0 cellPadding=3 width=550 border=0 style="border-collapse: collapse" bordercolor="#111111"> <TBODY> <TR> <TD> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <!-- <tr> class="header"> --> <tr> <!-- <td valign="left"><a href="' . HTTP_SERVER . DIR_WS_CATALOG . '"><IMG src="'. HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . STORE_LOGO .'" border=0></a></td> --> </tr> </table> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr class="infoBoxContents"> <td valign="middle" class="boxText"> ' . EMAIL_TEXT_DEAR . ' <STRONG> ' . $order->customer['firstname'] . ' ' . $order->customer['lastname'] .' </STRONG><br><br> ' . MESSAGE_SOCIETY . STORE_NAME . '<br><br> ' . CATEGORY_CONTACT . ' :<br> ' . EMAIL_TEXT_USER . ' : <b>' . $order->customer['email_address'] . '</b><br> ' . CATEGORY_ADDRESS_IP . ' : <b>' . $ip . '</b><br> <b>' . strftime(DATE_FORMAT_LONG) . ' ? ' .strftime('%H:%M:%S') .'</b><br> <!-- <HR width=400 color=black noShade SIZE=1> --> <br> </td> </tr> </table> <TABLE cellSpacing=0 cellPadding=1 width="100%" align=center border=0> <TBODY> <TR> <TD class="boxText"> <TABLE cellSpacing=0 cellPadding=2 width="100%" border=0> <TBODY> <TR> <TD align=middle class="boxText"> <font color="#000000">' . EMAIL_TEXT_INVOICE_URL . ' <b>' . $insert_id . '</b> </font> </TD> </TR> </TBODY> </TABLE> </TD> </TR> </TBODY> </TABLE> <br> <TABLE cellSpacing=0 cellPadding=1 width="100%" align=center border=0> <TBODY> <TR> <TD align=middle> <TABLE cellSpacing=1 cellPadding=3 width="100%" border=0> <TBODY> <tr> <td nowrap class="infoBoxHeading" bgcolor="#0066FF"><strong>' . EMAIL_TEXT_PRODUCTS . '</strong></td> <td nowrap class="infoBoxHeading" bgcolor="#0066FF"><strong>' . EMAIL_TEXT_PRODUCTS_MODEL . '</strong></td> <td width="20" align="center" class="infoBoxHeading" bgcolor="#0066FF"><strong>' . EMAIL_TEXT_PRODUCTS_QTY . '</strong></td> <td width="90" align="right" class="infoBoxHeading" bgcolor="#0066FF"><strong>' . EMAIL_TEXT_TOTAL . '</strong></td> <tr> <td valign="center" width="60%" nowrap class="infoBoxContents">' . $products_name . '</font> </td> <td vAlign=center align=middle nowrap class="infoBoxContents">' . $products_model . '</font></td> <td width="20" align="center" class="infoBoxContents">' . $products_quantity . '</font></td> <td width="90" align="right" class="infoBoxContents"><b>' . $products_price . '</font></b></td> </tr> </TBODY> </TABLE> <TABLE width="100%" border=0 cellPadding=0 cellSpacing=0> <TBODY> <TR> <TD align=center width="100%" align=middle class="boxText"> <a href="' . HTTP_SERVER . DIR_WS_CATALOG . 'account_history.php?order_id=' . $insert_id .'"> <IMG src="'. HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES .'order_detail.gif" border=0><br>' . EMAIL_TEXT_INVOICE_URL . '</a> </td> <!-- <TD nowrap align=right class="infoBoxHeading">' . $email_total . ' </TD> --> <TD nowrap align=right class="infoBoxContents">' . $email_order . ' </TD> </TR> </TBODY> </TABLE> </TD> </TR> </TBODY> </table> <br> <TABLE cellSpacing=1 cellPadding=3 width="100%" border=0> <TBODY> <TR> <TD width="50%" align=left class="infoBoxHeading" bgcolor="#0066FF"><B>' . EMAIL_TEXT_BILLING_ADDRESS . ' :</B></FONT></TD> <TD width="50%" align=left class="infoBoxHeading" bgcolor="#0066FF"><div align="left"><B>' . EMAIL_TEXT_DELIVERY_ADDRESS . ' :</B></div></TD> </TR> <TR valign="top"> <TD width="50%" align=left class="infoBoxContents">' . nl2br(tep_address_format($order->customer['format_id'], $order->customer, 1, ' ', "n")) . '</TD> <TD width="50%" align=middle class="infoBoxContents"><div align="left">' . nl2br(tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', "n")) . '</div></TD> </TR> </TBODY> </TABLE> <div align="center"><br> <font color="#000000" size="2"> <strong>' . EMAIL_TEXT_PAYMENT_METHOD . ' </strong> </font> </div> <TABLE cellSpacing=1 cellPadding=3 width="100%" border=0> <TBODY> <tr> <td nowrap class="infoBoxHeading"><B>' . $payment_class->title . ' </B></td> <tr> <td valign="center" width="60%" nowrap class="infoBoxContents">' . $payment_class->email_footer . '</font> </td> </tr> </TBODY> </TABLE> <br><br> <TABLE cellSpacing=0 cellPadding=3 width="100%" > <TBODY> <TR class="infoBoxContents"> <TD class="boxText"><br> ' . EMAIL_TEXT_PRODUCTS_CONTACT . STORE_PHONE . EMAIL_TEXT_PRODUCTS_ORCONTACT .' <a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . '</a><BR> </TD> </TR> </TBODY> </TABLE> </TD> </TR> </TBODY> </TABLE> </div> </body> </html> I have a problem when i receipt a mail. The code is html is correct in my opinion, but the problem come the server i think. 1/ The line concerning the total price, total shipping .... in the sheet is different with the customer e mail reception and the extra e mail (for the adminstrator). 2/ The screen is different between the customer e mail reception and extra e mail reception (several <br> between the line). I don't understand this problem, could you help me ? Thank you Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.