Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

add order number to invoice & packing slip


Guest

Recommended Posts

I didn't find this already posted, so I thought I'd share.

 

In admin/invoice.php. find this:

 <td class="pageHeading"><?php echo nl2br(STORE_NAME_ADDRESS); ?></td>

 

and add this line directly afterwards:

 <td class="pageHeading" align="right">Order #<?php echo $oID;?></font></a></td>

 

It helps me a lot to keep track of things.

 

-jared

Link to comment
Share on other sites

  • Replies 70
  • Created
  • Last Reply

Thanks Jarad, I always wanted that and wondered why it was left off of the invoices. I added a new row below that row and made it a smaller font, I also removed the </a> and </font>.

 

<tr>

<td align="right" colspan="2">Order #<?php echo $oID;?>  </td>

</tr>

Link to comment
Share on other sites

to add the date, change this:

include(DIR_WS_CLASSES . 'order.php');

$order = new order($oID);

 

to this:

include(DIR_WS_CLASSES . 'order.php');

$order = new order($oID);

$date = date('Y-M-d'); //you can play around with upper and lower case on the ('Y-M-d') to change the date format . . .

 

and this:

 

<td class="pageHeading"><?php echo nl2br(STORE_NAME_ADDRESS); ?></td>

<td class="pageHeading" align="right">Order #<?php echo $oID;?></font></td>

 

to this:

<td class="pageHeading"><?php echo nl2br(STORE_NAME_ADDRESS); ?></td>

<td class="pageHeading" align="right">Order #<?php echo $oID;?></font>

<br><font size="2"><?php echo $date; ?>  </td>

 

Better? :)

 

-jared

Link to comment
Share on other sites

Thanks for that, i started doing that myself a month ago but since i dont know anything about PHP i stumbled on the formatting of the date, so it displayed the time too :(

 

Little did i know it was that simple to adjust from long to short dates. Cheers. :D

Link to comment
Share on other sites

  • 3 weeks later...

slight update: I decided I wanted to put both the "orderered" and "invoiced' dates in there, so I couldn't just have today's date.

 

change the beginning of the file to look like this (the rest of the file is stock):

 

<?php

/*

$Id: invoice.php,v 1.6 2003/06/20 00:37:30 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

require(DIR_WS_CLASSES . 'currencies.php');

$currencies = new currencies();

 

$oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

$order = tep_db_query("select orders_id, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");

$order_query = tep_db_fetch_array($order);

 

 

include(DIR_WS_CLASSES . 'order.php');

$order = new order($oID);

$date = date('m/d/Y');

 

?>

<!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><?php echo TITLE; ?></title>

<link rel="stylesheet" type="text/css" href="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"><?php echo nl2br(STORE_NAME_ADDRESS); ?></td>

<td class="pageHeading" align="right">Order #<?php echo $oID;?>

<br><font size="2">Order Placed  <?php echo tep_date_short($order_query['date_purchased']); ?> 

<br>Final Invoice  <?php echo $date; ?>  </td>

<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . STORE_LOGO, STORE_NAME); ?></td>

</tr>

</table></td>

</tr>

 

If you don't like your store image in the invoice (I don't), then change this line:

<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . STORE_LOGO, STORE_NAME); ?></td>

 

to:

<!-- <td class="pageHeading" align="right">//<?php echo tep_image(DIR_WS_IMAGES . STORE_LOGO, STORE_NAME); ?></td> -->

 

-jared

Link to comment
Share on other sites

is there a short variable for the order amount, without tax and shipping, handling? need this for an affilliate program. this order id is perfect for what i need with it too!

Link to comment
Share on other sites

  • 4 weeks later...

Sorry for the late reply. To change the store logo on the packing slip/invoice, find this line and alter/comment/remote it:

 

<td class="pageHeading" align="right">//<?php echo tep_image(DIR_WS_IMAGES . STORE_LOGO, STORE_NAME); ?></td>

 

-jared

Link to comment
Share on other sites

John - - sort of.

 

The info you're looking for is in the orders_total table, but it's not straightforward to get to.

 

1) get the order number

2) look in the orders_total table for all fields that have orders_id matching that order number

3) in those matching fields (there should be 3), find the one where the "title" field value is "Sub-Total:". On that same one, you should be able to use either the "text" field or the "value" field, depending on which format you want to use.

 

Good luck with the contribution!

 

-jared

Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...
slight update: I decided I wanted to put both the "orderered" and "invoiced' dates in there, so I couldn't just have today's date.

 

change the beginning of the file to look like this (the rest of the file is stock):

 

<?php

/*

$Id: invoice.php,v 1.6 2003/06/20 00:37:30 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright ? 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

require(DIR_WS_CLASSES . 'currencies.php');

$currencies = new currencies();

 

$oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

$order = tep_db_query("select orders_id, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");

$order_query = tep_db_fetch_array($order);

 

 

include(DIR_WS_CLASSES . 'order.php');

$order = new order($oID);

$date = date('m/d/Y');

 

?>

<!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><?php echo TITLE; ?></title>

<link rel="stylesheet" type="text/css" href="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"><?php echo nl2br(STORE_NAME_ADDRESS); ?></td>

<td class="pageHeading" align="right">Order #<?php echo $oID;?>

<br><font size="2">Order Placed  <?php echo tep_date_short($order_query['date_purchased']); ?> 

<br>Final Invoice  <?php echo $date; ?>  </td>

<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . STORE_LOGO, STORE_NAME); ?></td>

</tr>

</table></td>

</tr>

 

If you don't like your store image in the invoice (I don't), then change this line:

<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . STORE_LOGO, STORE_NAME); ?></td>

 

to:

<!-- <td class="pageHeading" align="right">//<?php echo tep_image(DIR_WS_IMAGES . STORE_LOGO, STORE_NAME); ?></td> -->

 

-jared

I like this date part, but now on my invoice it shows:

 

Order Placed  07/24/2004

Final Invoice  Jul-30-2004

 

and I'd like both dates to be displayed as July 30th, 2004

 

how can I do this??

Link to comment
Share on other sites

Jeff - - see the line that says

  $date = date('m/d/Y');

?

 

If you change that to M/D/Y or m-D-y you will get differing results depending on the case (upper or lower) or the M, D, and Y. The characters in between can be whatever you want, or nothing (I think).

 

In other words, m/d/Y should give you 07/24/2004. m-d-Y should give you 07-24-2004. Play around with it a bit until you find what you want.

 

As for the "Order Placed" line, that's this:

Order Placed  <?php echo tep_date_short($order_query['date_purchased']); ?> 

 

As for changing to the "July 30th, 2004" format, I'm not sure which function displays in that format, but a quick search on oscdox.com returned these:

# tep_date_long() Definitions: 2 References: 14

# tep_date_raw() Definitions: 6 References: 20

# tep_date_short() Definitions: 2 References: 49

# tep_datetime_short() Definitions: 1 References: 6

 

I'm sure that they all work pretty much the same, so try substituting tep_date_long in the code instead of tep_date_short like I used.

 

Let us know how it works out!

 

-jared

Link to comment
Share on other sites

here is a nice one too, a copy from my older version of my store which is made by Linda McGrath & everyone else...lol

 

it gives a nice clean display, adjust the way you need it to be....

 

<?php
/*
 $Id: invoice.php,v 1.6 2003/06/20 00:37:30 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License

*/

 require('includes/application_top.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, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");

 include(DIR_WS_CLASSES . 'order.php');
 $order = new order($oID);

$the_extra_query= tep_db_query("select * from " . TABLE_ORDERS . " where orders_id = '" . tep_db_input($oID) . "'");
$the_extra= tep_db_fetch_array($the_extra_query);
$the_customers_id= $the_extra['customers_id'];
// Look up things in customers
$the_extra_query= tep_db_query("select * from " . TABLE_CUSTOMERS . " where customers_id = '" . $the_customers_id . "'");
$the_extra= tep_db_fetch_array($the_extra_query);
$the_customers_fax= $the_extra['customers_fax'];

?>
<!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><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="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"><?php echo nl2br(STORE_NAME_ADDRESS); ?></td>
       <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'oscommerce.gif', STORE_NAME, '250', '70'); ?></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>
<?php
if ($the_customers_fax) {
?>
             <tr>
               <td class="main"><b><?php echo 'FAX #:'; ?></b></td>
               <td class="main"><?php echo $the_customers_fax; ?></td>
             </tr>
<?php
}
?>
         <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">
<!-- Customers ID# // -->
<tr>
 <td class="main"><b>Customers # </b></td>
   <td class="main"><b>:</b></td>
 <td class="main"><?php echo $the_customers_id; ?></td>
</tr>
<!-- add Order # // -->
<tr>
 <td class="main"><b>Order # </b></td>
   <td class="main"><b>:</b></td>
 <td class="main"><?php echo tep_db_input($oID); ?></td>
</tr>
<!-- add Order Placed //-->
<tr>
 <td class="main"><b>Ordered Online </b></td>
   <td class="main"><b>:</b></td>
 <td class="main"><?php echo tep_datetime_short($order->info['date_purchased']); ?></td>
</tr>
<!-- add  Invoiced at Date // -->
<tr>
 <td class="main"><b>Invoice Date</b></td>
   <td class="main"><b>:</b></td>
 <td class="main"><?php echo date(PHP_DATE_TIME_FORMAT); ?></td>
</tr>
     <tr>
       <td class="main"><b>Payment Method</b></td>
   <td class="main"><b>:</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="3" align="center"><?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
// WebMakers.com Added: calculate total one time charges
   $total_one_time_charges=0;

   for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {

// BOF: WebMakers.com Added: show products image at 50%
// Look up products image
     if (SHOW_INVOICE_PRODUCTS_IMAGE=='') {
       $the_image_query=tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . $order->products[$i]['products_id'] . "'");
       $the_image= tep_db_fetch_array($the_image_query);
       echo '      <tr class="dataTableRow">' . "\n" .
            '        <td class="dataTableContent" valign="top" align="center">' . tep_image(DIR_WS_CATALOG_IMAGES . (($the_image['products_image'] != '') ? $the_image['products_image'] : 'products_small/no_picture.jpg'), SMALL_IMAGE_WIDTH * .50, SMALL_IMAGE_HEIGHT * .50) . '</td>' . "\n" .
            '        <td class="dataTableContent" valign="top" align="right">' . $order->products[$i]['qty'] . ' x</td>' . "\n" .
            '        <td class="dataTableContent" valign="top" align="left">' . $order->products[$i]['name'];
     } else {
       echo '      <tr class="dataTableRow">' . "\n" .
            '        <td class="dataTableContent" valign="top" align="right">' . $order->products[$i]['qty'] . ' x</td>' . "\n" .
            '        <td colspan="2" class="dataTableContent" valign="top" align="left">' . $order->products[$i]['name'];
     }
// EOF: WebMakers.com Added: show products image at 50%

     if (isset($order->products[$i]['attributes']) && (($k = sizeof($order->products[$i]['attributes'])) > 0)) {
       for ($j = 0; $j < $k; $j++) {
// WebMakers.com Added: show if attribute is FREE
         if ($order->products[$i]['attributes'][$j]['attributes_price_onetime'] != 0) {
           $new_attributes_price_onetime= '<br>' . '    ' . ATTRIBUTES_UNITS_ONETIME_TEXT . ' ' . $currencies->display_price($order->products[$i]['attributes'][$j]['attributes_price_onetime_ext'], $order->products[$i]['tax'], 1);
           $total_one_time_charges += $order->products[$i]['attributes'][$j]['attributes_price_onetime_ext'];
         } else {
           $new_attributes_price_onetime='';
         }
         if (!empty($order->products[$i]['attributes'][$j]['attributes_qty_prices_onetime'])) {
//            $new_attributes_qty_prices_onetime= '<br>' . '    ' . ATTRIBUTES_QTY_PRICE_ONETIME_TEXT . ' ' . $currencies->display_price(tep_get_attributes_qty_prices_onetime($order->products[$i]['attributes'][$j]['attributes_qty_prices_onetime'], $order->products[$i]['qty']), $order->products[$i]['tax'], 1);
           $new_attributes_qty_prices_onetime= '<br>' . '    ' . ATTRIBUTES_QTY_PRICE_ONETIME_TEXT . ' ' . $currencies->display_price($order->products[$i]['attributes'][$j]['attributes_qty_prices_onetime_ext'], $order->products[$i]['tax'], 1);
           $total_one_time_charges += $order->products[$i]['attributes'][$j]['attributes_qty_prices_onetime_ext'];
         } else {
           $new_attributes_qty_prices_onetime='';
         }
         echo '<br><nobr> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];
         echo '</i></nobr>';
         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']) . ')' . ($order->products[$i]['attributes'][$j]['product_attribute_is_free']=='1' ? ' - FREE' : '');
         }
         echo $new_attributes_price_onetime
              . $new_attributes_qty_prices_onetime;
       }
     }

     echo '        </td>' . "\n" .
          '        <td class="dataTableContent" valign="top" nowrap>' . $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="9"><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>
<?php
if (SHOW_ORDERS_COMMENTS_INVOICE=='') {
 require(DIR_WS_INCLUDES . 'order_comments.php');
}
?>
   </table></td>
 </tr>
</table>
<!-- body_text_eof //-->

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

Robert

 

We all need to learn it once, how hard it may seem when you look at it, also you will master it someday ;)

Link to comment
Share on other sites

  • 1 month later...

Thanks for the info on changing the invoice and packing slip. I have one other change I would like to make. I would prefer not to print the http path on the bottom left corner of the invoice and packing slip. Does anyone know where to turn this off.

 

Thanks in advance,

Mike

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...