Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

printing invoices


Guest

Recommended Posts

i am trying to use print invoice from checkout success, except i don't want to offer it on checkout success... just in the order conf email & on the order history page.

 

 

the problem is, when viewing the printable invoice, i get this:

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/**/public_html/includes/functions/general.php on line 60

 

 

and on line 60 of general.php:

return htmlspecialchars($string);

 

 

the only things that display properly are:

customer address

customer email

 

 

i do not need the lang files, because i have done those by hand already (couldn't find the lang file in the contribution package).

 

 

here's the source:

<?php
/*
 $Id: invoice.php,v 1.4 2003/02/16 15:42:33 wilt Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');
 //require('admin/includes/languages/english/invoice.php');

//  require(DIR_WS_CLASSES . 'currencies.php');
//  $currencies = new currencies();

 $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
 $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . tep_db_input($oID) . "'");

 include(DIR_WS_CLASSES . 'order.php');
 $order = new order($oID);
?>
<!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>osCommerce</title>
<link rel="stylesheet" type="text/css" href="admin/includes/stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">

<!-- body_text //-->
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
	<td class="pageHeading"><a href="#" onclick="window.print();return false"><font face="Arial, Helvetica, sans-serif" color="#0000CC" size="3">Print Invoice</font></a><br><br><?php echo nl2br(STORE_NAME_ADDRESS); ?></td>
	<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'osCommerce.gif', 'osCommerce', '244', '61'); ?></td>
  </tr>
</table></td>
 </tr>
 <tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="2">
  <tr>
	<td colspan="2"><?php echo tep_draw_separator(); ?></td>
  </tr>
  <tr>
	<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="main"><b><?php echo ENTRY_SOLD_TO; ?></b></td>
	  </tr>
	  <tr>
		<td class="main"><?php echo tep_address_format($order->customer['format_id'], $order->customer, 1, ' ', '<br>'); ?></td>
	  </tr>
	  <tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
	  </tr>
	  <tr>
		<td class="main"><?php echo $order->customer['telephone']; ?></td>
	  </tr>
	  <tr>
		<td class="main"><?php echo '<a href="mailto:' . $order->customer['email_address'] . '"><u>' . $order->customer['email_address'] . '</u></a>'; ?></td>
	  </tr>
	</table></td>
	<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="main"><b><?php echo ENTRY_SHIP_TO; ?></b></td>
	  </tr>
	  <tr>
		<td class="main"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>'); ?></td>
	  </tr>
	</table></td>
  </tr>
</table></td>
 </tr>
 <tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 </tr>
 <tr>
<td><table border="0" cellspacing="0" cellpadding="2">
<?php 
// BOF: WebMakers.com Added: Show Order Info 
?> 
<!-- add Order # // --> 
<tr> 
<td class="main"><b>Order # </b></td> 
<td class="main">R<?php echo tep_db_input($oID); ?></td> 
</tr> 
<!-- add date/time // --> 
<tr> 
<td class="main"></td> 
<td class="main"></td> 
</tr> 
<?php 
// EOF: WebMakers.com Added: Show Order Info 
?> 
  <tr>
	<td class="main"><b><?php echo ENTRY_PAYMENT_METHOD; ?></b></td>
	<td class="main"><?php echo $order->info['payment_method']; ?></td>
  </tr>
</table></td>
 </tr>
 <tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 </tr>
 <tr>
<td><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"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></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 (($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";
 }
?><br><br><a href="#" onclick="window.print();return false"><font face="Arial, Helvetica, sans-serif" color="#0000CC" size="3">Print Invoice</font></a>
	</table></td>
  </tr>
</table></td>
 </tr>
</table>
<!-- body_text_eof //-->

<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...