Ordrekvittering - Oscommerce
Har brug for lidt php hjælp.Har lavet en shop i OsCommerce. Har indstalleret et modul der hedder Fancier invoice som gør at shoppen sender ordrekvittering som html.
Nu skal jeg have tilføjet dankort på siden. Det foregår igennem Fribetaling med deres Oscommerce modul.
Problemet er nu at jeg skal have dankort transaktionsnr. udskrevet på kvitteringen.
Jeg har indsat følgende på kvitteringen:
<!--FRIBETALING -->
<?php echo ENTRY_FRIBETALING_TRANSACTION_ID; ?>
<?php echo $order->info['cc_transactionid']; ?>
<!-- SLUT -->
1.linje udskriver en tekst: "TransaktionsID"
2. linje udskriver dankort transaktionsnr hvis der er et
Der bliver korrekt udskrevet transaktionsnr på kvitteringen når der bruges dankort. Det egentlige problem er at jeg ikke kan "skjule" tekst strengen når der ikke betales med dankort.
Transaktiosnid bliver er jo bare tomt hvis der ikke betales med dankort så det er i princippet ikke noget problem!
Nogen der kan hjælpe med det?
Her er hele koden til kvitteringsfilen: (Kan downloades her: www.jlmedia.dk/files/html_invoice.zip )
START html_invoice.php
--------------------------------------------------------------
<?php
/*
$Id: html_invoice.php,v 6.1 2005/06/05 00:37:30 PopTheTop Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
class objectInfo {
// class constructor
function objectInfo($object_array) {
reset($object_array);
while (list($key, $value) = each($object_array)) {
$this->$key = tep_db_prepare_input($value);
}
}
}
?>
<html>
<head>
<title><?php echo STORE_NAME; ?> <?php echo INVOICE_TEXT_INVOICE; ?> <?php echo INVOICE_TEXT_NUMBER_SIGN; ?><?php echo date("y"); ?><?php echo INVOICE_TEXT_DASH; ?><?php echo $oID; ?></title>
<style type="text/css">
BODY { background: #ffffff; color: #000000; margin: 0px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size: 10px; }
TD, TR { font-family:Verdana, Arial, Helvetica, sans-serif; font-size: 10px; }
A { color: #000000; text-decoration: none; }
A:hover { color: #AABBDD; text-decoration: underline; }
A.headerNavigation { color: #FFFFFF; }
A.headerNavigation:hover { color: #ffffff; }
TD.main, P.main { font-family: Verdana, Arial, sans-serif; font-size: 10px; line-height: 1.5; }
TD.smallText, SPAN.smallText, P.smallText { font-family: Verdana, Arial, sans-serif; font-size: 10px; }
.dataTableContent { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #000000; }
.dataTableHeadingRow { background-color: #C9C9C9; }
.dataTableHeadingContent { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #ffffff; font-weight: bold; }
.dataTableRow { background-color: #F0F1F1; }
.payment{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
}
</style>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td align="left"><?php echo '<img src="' . INVOICE_IMAGE . '" border="0" alt="' . INVOICE_IMAGE_ALT_TEXT . '" width="' . INVOICE_IMAGE_WIDTH . '" height="' . INVOICE_IMAGE_HEIGHT . '" hspace="10">'; ?></td>
<TD ALIGN="right" VALIGN="top" NOWRAP><FONT FACE="Verdana" SIZE="2" COLOR="#006699"><strong><?php echo INVOICE_TEXT_INVOICE; ?> <?php echo INVOICE_TEXT_NUMBER_SIGN; ?><?php echo $oID; ?></strong></font>
<hr size="2">
<FONT FACE="Verdana" SIZE="2" COLOR="#006699"><strong><BR>
<?php echo $date; ?></strong></font><br>
<br><span class="pageHeadingSM"><FONT FACE="Verdana" SIZE="1" COLOR="#006699"><strong><?php echo nl2br(STORE_NAME_ADDRESS); ?></strong></font></span></TD>
</tr>
<tr>
<td colspan="2">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<TD>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td colspan="4">
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="10%"><hr size="2"></td>
<td align="center" class="pageHeading" NOWRAP><em><b><?php echo INVOICE_TEXT_INVOICE; ?></b></em></td>
<td width="100%"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="4"><img src="<?php echo $ei_image_dir; ?>pixel_trans.gif" width="100" height="5" alt=""></td>
</tr>
<tr>
<td width="3"> </td>
<td valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="11"><img src="<?php echo $ei_image_dir; ?>borders/mainwhite_01.gif" width="11" height="16" alt=""></td>
<td background="<?php echo $ei_image_dir; ?>borders/mainwhite_02.gif"><img src="<?php echo $ei_image_dir; ?>borders/mainwhite_02.gif" width="24" height="16" alt="" ></td>
<td width="19"><img src="<?php echo $ei_image_dir; ?>borders/mainwhite_03.gif" width="19" height="16" alt=""></td>
</tr>
<tr>
<td background="<?php echo $ei_image_dir; ?>borders/mainwhite_04.gif"><img src="<?php echo $ei_image_dir; ?>borders/mainwhite_04.gif" width="11" height="21" alt=""></td>
<td align="center"">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="main">
<tr>
<td align="left" valign="top"><b><?php echo ENTRY_SOLD_TO; ?></b></td>
</tr>
<tr>
<td> <img src="<?php echo $ei_image_dir; ?>pixel_trans.gif" width="1" height="5" alt=""></td>
</tr>
<tr>
<td NOWRAP> <?php echo tep_address_format($order->customer['format_id'], $order->customer, 1, '', '<br> '); ?></td>
</tr>
<tr>
<td> <img src="<?php echo $ei_image_dir; ?>pixel_trans.gif" width="1" height="10" alt=""></td>
</tr>
<tr>
<td NOWRAP> <?php echo $order->customer['telephone']; ?></td>
</tr>
<tr>
<td NOWRAP> <?php echo $order->customer['email_address']; ?></td>
</tr>
<tr>
<td><img src="<?php echo $ei_image_dir; ?>pixel_trans.gif" width="1" height="7" alt=""></td>
</tr>
</table>
</td>
<td background="<?php echo $ei_image_dir; ?>borders/mainwhite_06.gif"><img src="<?php echo $ei_image_dir; ?>borders/mainwhite_06.gif" width="19" height="21" alt=""></td>
</tr>
<tr>
<td><img src="<?php echo $ei_image_dir; ?>borders/mainwhite_07.gif" width="11" height="18" alt=""></td>
<td background="<?php echo $ei_image_dir; ?>borders/mainwhite_08.gif"><img src="<?php echo $ei_image_dir; ?>borders/mainwhite_08.gif" width="24" height="18" alt=""></td>
<td><img src="<?php echo $ei_image_dir; ?>borders/mainwhite_09.gif" width="19" height="18" alt=""></td>
</tr>
</table>
</td>
<td width="45"> </td>
<td valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="11"><img src="<?php echo $ei_image_dir; ?>borders/mainwhite_01.gif" width="11" height="16" alt=""></td>
<td background="<?php echo $ei_image_dir; ?>borders/mainwhite_02.gif"><img src="<?php echo $ei_image_dir; ?>borders/mainwhite_02.gif" width="24" height="16" alt=""></td>
<td width="19"><img src="<?php echo $ei_image_dir; ?>borders/mainwhite_03.gif" width="19" height="16" alt=""></td>
</tr>
<tr>
<td background="<?php echo $ei_image_dir; ?>borders/mainwhite_04.gif"><img src="<?php echo $ei_image_dir; ?>borders/mainwhite_04.gif" width="11" height="21" alt=""></td>
<td align="center" bgcolor="#FFFFFF">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="main">
<tr>
<td align="left" valign="top"><b><?php echo ENTRY_SHIP_TO; ?></b></td>
</tr>
<tr>
<td> <img src="<?php echo $ei_image_dir; ?>pixel_trans.gif" width="1" height="5" alt=""></td>
</tr>
<tr>
<td NOWRAP> <?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br> '); ?></td>
</tr>
<tr>
<td> <img src="<?php echo $ei_image_dir; ?>pixel_trans.gif" width="1" height="10" alt=""></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><img src="<?php echo $ei_image_dir; ?>pixel_trans.gif" width="1" height="7" alt=""></td>
</tr>
</table>
</td>
<td background="<?php echo $ei_image_dir; ?>borders/mainwhite_06.gif"><img src="<?php echo $ei_image_dir; ?>borders/mainwhite_06.gif" width="19" height="21" alt=""></td>
</tr>
<tr>
<td><img src="<?php echo $ei_image_dir; ?>borders/mainwhite_07.gif" width="11" height="18" alt=""></td>
<td background="<?php echo $ei_image_dir; ?>borders/mainwhite_08.gif"><img src="<?php echo $ei_image_dir; ?>borders/mainwhite_08.gif" width="24" height="18" alt=""></td>
<td><img src="<?php echo $ei_image_dir; ?>borders/mainwhite_09.gif" width="19" height="18" alt=""></td>
</tr>
</table>
</td>
</tr>
</table>
</TD>
</tr>
<tr>
<TD COLSPAN="2"><img src="<?php echo $ei_image_dir; ?>pixel_trans.gif" width="100" height="15" alt=""></td>
</tr>
<tr>
<TD COLSPAN="2">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="9"> </td>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="11"><img src="<?php echo $ei_image_dir; ?>borders/maingrey_01.gif" width="11" height="16" alt=""></td>
<td background="<?php echo $ei_image_dir; ?>borders/maingrey_02.gif"><img src="<?php echo $ei_image_dir; ?>borders/maingrey_02.gif" width="24" height="16" alt="" ></td>
<td width="19"><img src="<?php echo $ei_image_dir; ?>borders/maingrey_03.gif" width="19" height="16" alt=""></td>
</tr>
<tr>
<td background="<?php echo $ei_image_dir; ?>borders/maingrey_04.gif"><img src="<?php echo $ei_image_dir; ?>borders/maingrey_04.gif" width="11" height="21" alt=""></td>
<td align="center">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="main" bgcolor="#cccccc">
<tr>
<td width="50%" height="25" NOWRAP> <b><?php echo INVOICE_TEXT_ORDER; ?> <?php echo INVOICE_TEXT_NUMBER_SIGN; ?><?php echo INVOICE_TEXT_COLON; ?></b> <?php echo tep_db_input($oID); ?></td>
<?php
if (tep_not_null($order->info['cc_number'])) {
$this->cc_card_number_less_middle_digits = substr($order->info['cc_number'], 0, 4) . str_repeat('x', (strlen($order->info['cc_number']) - 8)) . substr($order->info['cc_number'], -4);
?>
<td width="50%" NOWRAP> <b><?php echo ENTRY_PAYMENT_METHOD; ?></b> <?php echo $order->info['payment_method']; ?> (<?php echo $order->info['cc_type']; ?>)<br><img src="<?php echo $ei_image_dir; ?>pixel_trans.gif" width="100%" height="6" alt=""><br> <b><?php echo ENTRY_PAYMENT_CC_NUMBER; ?></b> <?php echo $this->cc_card_number_less_middle_digits; ?></td>
<?php
} else {
?>
<td width="50%" NOWRAP> <b><?php echo ENTRY_PAYMENT_METHOD; ?></b> <?php echo $order->info['payment_method']; ?> - <!--FRIBETALING -->
<?php echo ENTRY_FRIBETALING_TRANSACTION_ID; ?>
<?php echo $order->info['cc_transactionid']; ?>
<!-- SLUT --></td>
<?php
}
?>
</tr>
<tr>
<td><img src="<?php echo $ei_image_dir; ?>pixel_trans.gif" width="1" height="7" alt=""></td>
</tr>
</table>
</td>
<td background="<?php echo $ei_image_dir; ?>borders/maingrey_06.gif"><img src="<?php echo $ei_image_dir; ?>borders/maingrey_06.gif" width="19" height="21" alt=""></td>
</tr>
<tr>
<td><img src="<?php echo $ei_image_dir; ?>borders/maingrey_07.gif" width="11" height="18" alt=""></td>
<td background="<?php echo $ei_image_dir; ?>borders/maingrey_08.gif"><img src="<?php echo $ei_image_dir; ?>borders/maingrey_08.gif" width="24" height="18" alt=""></td>
<td><img src="<?php echo $ei_image_dir; ?>borders/maingrey_09.gif" width="19" height="18" alt=""></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<TD COLSPAN="2"><img src="<?php echo $ei_image_dir; ?>pixel_trans.gif" width="1" height="15" alt=""></td>
</tr>
<tr>
<TD COLSPAN="2"><img src="<?php echo $ei_image_dir; ?>pixel_trans.gif" width="1" height="10" alt=""></td>
</tr>
<tr>
<TD COLSPAN="2">
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr class="dataTableHeadingRow">
<td class="dataTableHeadingContent" colspan="2"><?php echo TABLE_HEADING_PRODUCTS; ?></td>
<td class="dataTableHeadingContent"> </td>
<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TAX; ?></td>
<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_EXCLUDING_TAX; ?></td>
<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_INCLUDING_TAX; ?></td>
<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_EXCLUDING_TAX; ?></td>
<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_INCLUDING_TAX; ?></td>
</tr>
<?php
for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
echo ' <tr class="dataTableRow">' . "\n" .
' <td class="dataTableContent" valign="top" align="right">' . $order->products[$i]['qty'] . ' x</td>' . "\n" .
' <td class="dataTableContent" valign="top">' . $order->products[$i]['name'];
if (isset($order->products[$i]['attributes']) && (($k = sizeof($order->products[$i]['attributes'])) > 0)) {
for ($j = 0; $j < $k; $j++) {
echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];
if ($order->products[$i]['attributes'][$j]['price'] != '0') echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')';
echo '</i></small></nobr>';
}
}
echo ' </td>' . "\n" .
' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n";
echo ' <td class="dataTableContent" align="right" valign="top">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n" .
' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .
' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .
' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .
' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n";
echo ' </tr>' . "\n";
}
?>
<tr>
<td align="right" colspan="8">
<table border="0" cellspacing="0" cellpadding="2">
<?php
for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {
echo ' <tr>' . "\n" .
' <td align="right" class="smallText">' . $order->totals[$i]['title'] . '</td>' . "\n" .
' <td align="right" class="smallText">' . $order->totals[$i]['text'] . '</td>' . "\n" .
' </tr>' . "\n";
}
?>
</table>
</td>
</tr>
</table></td>
</tr>
</table>
<?php
$orders_status_history_query = tep_db_query("select * from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . tep_db_input($oID) . "' order by date_added");
if (tep_db_num_rows($orders_status_history_query)) {
$has_comments = false;
?>
<br>
<br>
<table width="100%" border="2" cellpadding="5" cellspacing="0" bordercolor="#CCCCCC">
<tr>
<td bgcolor="#CCCCCC"><b><?php echo TABLE_HEADING_COMMENTS; ?></b></td>
</tr>
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="main">
<?php
while ($orders_comments = tep_db_fetch_array($orders_status_history_query)) {
if (tep_not_null($orders_comments['comments'])) {
$has_comments = true; // Not Null = Has Comments
if (tep_not_null($orders_comments['comments'])) {
$sInfo = new objectInfo($orders_comments);
?>
<tr>
<td align="center" width="100%"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" class="smallText"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="main">
<tr>
<td width="150" align="left" valign="top" class="smallText"><strong><u><?php echo TABLE_HEADING_DATE_ADDED; ?></u></strong></td>
<td align="left" valign="top" class="smallText"><strong><u><?php echo TABLE_HEADING_COMMENT_LEFT; ?></u></strong></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center" width="100%"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" class="smallText"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="main">
<tr>
<td width="150" align="left" valign="top" class="smallText"><?php echo tep_date_short($sInfo->date_added); ?></td>
<td align="left" valign="top" class="smallText"><?php echo nl2br(tep_db_output($orders_comments['comments'])); ?><br>
<br></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<?php
}
}
}
if ($has_comments == false) {
?>
<tr>
<td align="center" width="100%"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" class="smallText"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="main">
<tr>
<td width="100%" align="left" valign="top" class="smallText"><?php echo INVOICE_TEXT_NO_COMMENT; ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<?php
}
?>
<tr>
<td><img src="<?php echo HTTP_SERVER; ?>/catalog/images/pixel_trans.gif" width="1" height="7" alt=""></td>
</tr>
</table></td>
<td width="19" background="<?php echo HTTP_SERVER; ?>/catalog/images/borders/maingrey_06.gif"> </td>
</tr>
</table></td>
</tr>
</table>
<br>
<table width="100%" border="0" cellpadding="5" bordercolor="#EEEEEE" bgcolor="#FFFFFF" style="border-collapse: collapse;">
<tr>
<td colspan="2" align="center"><table width="100%" border="2" cellpadding="5" cellspacing="0" bordercolor="#CCCCCC">
<tr>
<td height="20" bgcolor="#C9C9C9" class="payment"><p><strong>Betalingsinformation:</strong></p>
</td>
</tr>
<tr>
<td class="payment">
<p><strong><br>
Bankoverførsel:</strong><br>
Overfør beløbet til konto: <em>4630-4630015855</em>. Anfør ordrenr. ved overførslen. Varene vil blive sendt når betalingen er modtaget.</p>
<p><strong>Check:</strong><br>
Send en check til Mykidz, Alsædtægten 13, St. Darum, 6740 Bramming. Anfør venligst ordrenummer på checken. </p>
<p><strong>Efterkrav:</strong><br>
Varene vil blive sendt pr. efterkrav med Postdanmark.</p>
<p><strong>Afhentning:</strong><br>
Afhentning af varer kan ske i vores butik på Alsædtægten 13, St. Darum, 6740 Bramming. Åbningstider tirsdag - torsdag 16 - 21. For afhentning uden for åbningstid kontakt os da på telefon 75 17 94 84 eller 24 58 76 96.</p></td>
</tr>
</table>
<?php
}
?>
<br>
<CENTER><span class="smallText"><FONT FACE="Verdana" COLOR="#006699"><strong><?php echo INVOICE_TEXT_THANK_YOU; ?><BR><?php echo STORE_NAME; ?><BR><?php echo STORE_URL_ADDRESS; ?></strong></font></span></CENTER>
</body>
</html>
-------------------------------------------------------------
SLUT html_invoice.php
