Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[contribution] Print Order Receipt


Recommended Posts

HI:

 

Looks Super! But, I use black for my site background and want to change the printed page to white instead with black type. Can anyone help with the stylesheet definitions for this?

 

Thanks,

 

Jen

Link to comment
Share on other sites

  • Replies 53
  • Created
  • Last Reply

Top Posters In This Topic

I figured it out!!

 

HI:

 

Looks Super! But, I use black for my site background and want to change the printed page to white instead with black type. Can anyone help with the stylesheet definitions for this?

 

Thanks,

 

Jen

Link to comment
Share on other sites

Could you be any more specific? Example perhaps?

For my purposes, I need to single out our online Gift Certificate. With the order receipt a customer can order a gift certificate, a hat, and a shirt, let's say. All of these items will appear on the receipt. What I would like to do is be able to single out the gift certificate and have it the only item that appears on the receipt. I would need a command that will search the open order and display only the item number I choose.

 

Any thoughts?

Link to comment
Share on other sites

  • 1 month later...

I am using the older copy of this but I am curious if the same problem still exists.

 

When a person places an order and goes to print the receipt. At the top I have print_order2.php?oID=9345

 

If someone changes the numbers at the end of the address they can see someone else's mailing address and what they purchases.

 

I am also running purchase without a account so customers still need to be able to access the page without being logged in.

 

Anyone else having this issue??

Edited by bcmiw330
Link to comment
Share on other sites

I am using the older copy of this but I am curious if the same problem still exists.

 

When a person places an order and goes to print the receipt. At the top I have print_order2.php?oID=9345

 

If someone changes the numbers at the end of the address they can see someone else's mailing address and what they purchases.

 

I am also running purchase without a account so customers still need to be able to access the page without being logged in.

 

Anyone else having this issue??

I answered my own question!! Sorry

Link to comment
Share on other sites

  • 4 weeks later...

A couple of suggestions:

 

Remove the php 'echo' statement from within the echo statement at print_header.php:

 

<td valign="center" align="left"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_i
mage(DIR_WS_IMAGES . 'oscommerce.gif', nl2br(STORE_NAME)) . '</a>'; ?></td>

 

There seem to be some missing closing 'td' tags in the contribution html, and move the closing 'a' tags to outside of the echo statements where the opening tag is already outside, to improve editor readability.

 

Thank you for a very useful contribution.

For ALL problems, please review this link first -> osCommerce Knowledge Base

Link to comment
Share on other sites

A couple of suggestions:

 

Remove the php 'echo' statement from within the echo statement at print_header.php:

 

<td valign="center" align="left"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_i
mage(DIR_WS_IMAGES . 'oscommerce.gif', nl2br(STORE_NAME)) . '</a>'; ?></td>

 

There seem to be some missing closing 'td' tags in the contribution html, and move the closing 'a' tags to outside of the echo statements where the opening tag is already outside, to improve editor readability.

 

Thank you for a very useful contribution.

I am a bit thick and cannot follow what you are saying, could you please elaborate.

Link to comment
Share on other sites

  • 1 month later...

First of all great contribution, thanks to the authors.

 

Just wish to know if it's possible to add the product descriptions to the print_order.php and print_order2.php (not sure which file, i think it's both). The rationale is, to allow our clients to have their boss/supervisor sign on the printed page(approval) and have the document faxed back to us. Just so we're protected, we wish to indicate the product description in the order receipt.

 

Any help would be appreciated.

Link to comment
Share on other sites

  • 1 month later...

I just installed this yesterday.

 

When I try to print a current invoice the button is there but nothing happens when you click on print.

 

I decided to give it a rest overnight and compare all the files to the info in your instructions first thing in the morning. I did that and made a few corrections and now the invoices in History will print (love it!) but I still get nothing when I click on the Print Invoice button in a newly confirmed order. Please help.

Link to comment
Share on other sites

  • 1 month later...

Hi there!

 

Since I added this contrib I got a problem in my account_history_info. php.

 

All order details are shown, but there is no entry in the delivery and the billing adress field. Both fields are empty. (I don´t know if the names are correct, becaus my shop is comletly in german. There ist is "Rechnungsadresse" and "Lieferadresse".)

 

Need help please.

 

Greetz,

Nicole

Link to comment
Share on other sites

  • 1 month later...

Hello,

 

I just installed this on the 20060817 version and when I print from the order history I get the following under order history.

 

1054 - Unknown column 'os.public_flag' in 'where clause'

 

select os.orders_status_name, osh.date_added, osh.comments from orders_status os, orders_status_history osh where osh.orders_id = '40008' and osh.orders_status_id = os.orders_status_id and os.language_id = '1' and os.public_flag = '1' order by osh.date_added

 

Also, the order number does not show up when I print the confirmation while placing the order.

 

Thanks for your help.

 

Bob

Link to comment
Share on other sites

Hello,

 

I just installed this on the 20060817 version and when I print from the order history I get the following under order history.

 

1054 - Unknown column 'os.public_flag' in 'where clause'

 

select os.orders_status_name, osh.date_added, osh.comments from orders_status os, orders_status_history osh where osh.orders_id = '40008' and osh.orders_status_id = os.orders_status_id and os.language_id = '1' and os.public_flag = '1' order by osh.date_added

 

Also, the order number does not show up when I print the confirmation while placing the order.

 

Thanks for your help.

 

Bob

 

Update: I found how to show the order number, but still have the error above in the footer area under Order History. I don't need the footer printed, can I just remove it from printing to see if that where the error comes from?

 

Thanks,

 

Bob

Link to comment
Share on other sites

  • 3 weeks later...

Hi, I just installed & went to print and got this:

 

Fatal error: Call to a member function checkTarget() on a non-object in /home/bellafav/public_html/print_order.php on line 48.

Here is the code, does anyone know how to fix this? Line 48 is is in bold below.

 

 

 

<?php
/*
 $Id: printorder.php,v 1.100 2003/06/09 23:03:52 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 if (!tep_session_is_registered('customer_id')) {
   $navigation->set_snapshot();
   tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 }

   if (!isset($HTTP_GET_VARS['order_id']) || (isset($HTTP_GET_VARS['order_id']) && !is_numeric($HTTP_GET_VARS['order_id']))) {
   tep_redirect(tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL'));
 }
  $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . tep_db_input($oID) . "'");
 $customer_info_query = tep_db_query("select customers_id from " . TABLE_ORDERS . " where orders_id = '". (int)$HTTP_GET_VARS['order_id'] . "'");
 $customer_info = tep_db_fetch_array($customer_info_query);
 if ($customer_info['customers_id'] != $customer_id) {
   tep_redirect(tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL'));
 }

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ORDERS_PRINTABLE_INFO);

 $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));
 $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL'));
 $breadcrumb->add(sprintf(NAVBAR_TITLE_3, $HTTP_GET_VARS['order_id']), tep_href_link
(FILENAME_ORDERS_PRINTABLE_INFO, 'order_id=' . $HTTP_GET_VARS['order_id'], 'SSL'));

 require(DIR_WS_CLASSES . 'order.php');
 $order = new order($HTTP_GET_VARS['order_id']);
?>
<!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; ?>">
<?php
/*** Begin Header Tags SEO ***/
if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
ob_start();
require(DIR_WS_INCLUDES . 'header_tags.php');
[b]$preventDuplicates->checkTarget(ob_get_clean());[/b]
echo $preventDuplicates->finalMeta . "\n";
} else {
?>
<title><?php echo TITLE; ?></title>
<?php
}
/*** End Header Tags SEO ***/
?>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<?php
// begin Print Receipt
?>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'print_header.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 
'table_background_history.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr>
           <td class="main" colspan="2"><b><?php echo sprintf(HEADING_ORDER_NUMBER, $HTTP_GET_VARS['order_id']) . 
' <small>(' . $order->info['orders_status'] . ')</small>'; ?></b></td>
         </tr>
         <tr>
           <td class="smallText"><?php echo HEADING_ORDER_DATE . ' ' . tep_date_long($order->info['date_purchased']); ?>
</td>
           <td class="smallText" align="right"><?php echo HEADING_ORDER_TOTAL . ' ' . $order->info['total']; ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
<?php
 if ($order->delivery != false) {
?>
           <td width="30%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td class="main"><b><?php echo HEADING_DELIVERY_ADDRESS; ?></b></td>
             </tr>
             <tr>
               <td class="main"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>'); ?>
</td>
             </tr>
<?php
   if (tep_not_null($order->info['shipping_method'])) {
?>
             <tr>
               <td class="main"><b><?php echo HEADING_SHIPPING_METHOD; ?></b></td>
             </tr>
             <tr>
               <td class="main"><?php echo $order->info['shipping_method']; ?></td>
             </tr>
<?php
   }
?>
           </table></td>
<?php
 }
?>
           <td width="<?php echo (($order->delivery != false) ? '70%' : '100%'); ?>" valign="top"><table border="0" width="100%" 
cellspacing="0" cellpadding="0">
             <tr>
               <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
 if (sizeof($order->info['tax_groups']) > 1) {
?>
                 <tr>
                   <td class="main" colspan="2"><b><?php echo HEADING_PRODUCTS; ?></b></td>
                   <td class="smallText" align="right"><b><?php echo HEADING_TAX; ?></b></td>
                   <td class="smallText" align="right"><b><?php echo HEADING_TOTAL; ?></b></td>
                 </tr>
<?php
 } else {
?>
                 <tr>
                   <td class="main" colspan="3"><b><?php echo HEADING_PRODUCTS; ?></b></td>
                 </tr>
<?php
 }

 for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
   echo '          <tr>' . "\n" .
        '            <td class="main" align="right" valign="top" width="30">' . $order->products[$i]['qty'] . ' x</td>' . "\n" .
        '            <td class="main" valign="top">' . $order->products[$i]['name'];

   if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {
     for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
       echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes']
[$j]['value'] . '</i></small></nobr>';
     }
   }

   echo '</td>' . "\n";

   if (sizeof($order->info['tax_groups']) > 1) {
     echo '            <td class="main" valign="top" align="right">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n";
   }

   echo '            <td class="main" align="right" valign="top">' . $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']) . '</td>' . "\n" .
        '          </tr>' . "\n";
 }
?>
               </table></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td class="main"><b><?php echo HEADING_BILLING_INFORMATION; ?></b></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td width="30%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td class="main"><b><?php echo HEADING_BILLING_ADDRESS; ?></b></td>
             </tr>
             <tr>
               <td class="main"><?php echo tep_address_format($order->billing['format_id'], $order->billing, 1, ' ', '<br>'); ?></td>
             </tr>
             <tr>
               <td class="main"><b><?php echo HEADING_PAYMENT_METHOD; ?></b></td>
             </tr>
             <tr>
               <td class="main"><?php echo $order->info['payment_method']; ?></td>
             </tr>
           </table></td>
           <td width="70%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
 for ($i=0, $n=sizeof($order->totals); $i<$n; $i++) {
   echo '              <tr>' . "\n" .
        '                <td class="main" align="right" width="100%">' . $order->totals[$i]['title'] . '</td>' . "\n" .
        '                <td class="main" align="right">' . $order->totals[$i]['text'] . '</td>' . "\n" .
        '              </tr>' . "\n";
 }
?>
           </table></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td class="main"><b><?php echo HEADING_ORDER_HISTORY; ?></b></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
 $statuses_query = tep_db_query("select os.orders_status_name, osh.date_added, osh.comments from " . 
TABLE_ORDERS_STATUS . " os, " . TABLE_ORDERS_STATUS_HISTORY . " osh where osh.orders_id = '" . (int)$HTTP_GET_VARS['order_id'] . 
"' and osh.orders_status_id = os.orders_status_id and os.language_id = '" . (int)$languages_id . "' and os.public_flag = '1' order by osh.date_added");
 while ($statuses = tep_db_fetch_array($statuses_query)) {
   echo '              <tr>' . "\n" .
        '                <td class="main" valign="top" width="70">' . tep_date_short($statuses['date_added']) . '</td>' . "\n" .
        '                <td class="main" valign="top" width="70">' . $statuses['orders_status_name'] . '</td>' . "\n" .
        '                <td class="main" valign="top">' . (empty($statuses['comments']) ? ' ' : nl2br(tep_output_string_protected($statuses['comments']))) . '</td>' . "\n" .
        '              </tr>' . "\n";
 }
?>
           </table></td>
         </tr>
       </table></td>
     </tr>
    <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>

   </table><!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'print_footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Edited by charinlasvegas
Link to comment
Share on other sites

  • 1 month later...

Does anyone know what changes were made in the "Print Order Receipt v1.5 Update" uploaded by apurba_soft Nov. 4, 2008? Also, what do you get for "Payment Method" using v 1.5 if you're not storing credit card numbers in your database? I realize this was asked previously in the support thread, but was never answered....

Thanks,

Bob

Link to comment
Share on other sites

  • 3 weeks later...

Hi,

I got the following error and I don`t know why?!

Any idea?

1054 - Unknown column 'os.public_flag' in 'where clause'

select os.orders_status_name, osh.date_added, osh.comments from orders_status os, orders_status_history osh where osh.orders_id = '1' and osh.orders_status_id = os.orders_status_id and os.language_id = '2' and os.public_flag = '1' order by osh.date_added

[TEP STOP]

Thank you!

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

I still got the following error and I don`t know why?!

It does not appear after checkout,

only when I`m looking at my history and then trying to print invoice.

The error comes at the Order History Line before the footer...

Any idea?

1054 - Unknown column 'os.public_flag' in 'where clause'

select os.orders_status_name, osh.date_added, osh.comments from orders_status os, orders_status_history osh where osh.orders_id = '1' and osh.orders_status_id = os.orders_status_id and os.language_id = '2' and os.public_flag = '1' order by osh.date_added

[TEP STOP]

Thank you!

Link to comment
Share on other sites

  • 6 months later...
Great contrib. Thank you!

Question about checkount_success.php

Do you have a solution for PWA?

All I want to do is only show the receipt button if a person is logged in, otherwise if they are PWA no button for them.

 

 

What I did was create a page for PWA people called orders_printable_pwa.php

so the invoice button is still on checkout_success page but the pop-up appears

with alternative text for those who purchased without account.

 

in print_order2.php

changed this

if (!tep_session_is_registered('customer_id')) {

$navigation->set_snapshot();

tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

 

to this

if (!tep_session_is_registered('customer_id')) {

$navigation->set_snapshot();

tep_redirect(tep_href_link(FILENAME_ORDERS_PRINTABLE_PWA, '', 'SSL'));

 

in filenames.php added a new file

define('FILENAME_ORDERS_PRINTABLE_PWA', 'print_order_pwa.php');

 

Now if someone checks out without account they get a message something like

- since you checked out without creating an account your receipt is only available through email, please check your email for order confirmation.

Link to comment
Share on other sites

  • 3 weeks later...

Hello,

 

I installed Print Order Receipt v1.5 but i have this error

 

1054 - Unknown column 'shipping_cost' in 'field list'

 

select date_purchased, orders_status, last_modified, shipping_cost, shipping_method,comments from orders where orders_id = '16'

 

Any idea?

Link to comment
Share on other sites

Hi,

got a solution!

Just delete the following part in print_order.php:

' and os.public_flag = '0'

That`s all!

Greetings!

 

 

I tried this and it did not work. My code actually has a "1" instead of "0" after the = sign.

 

Any other solutions? Here is what it looks like.

 

Error Message

1054 - Unknown column 'os.public_flag' in 'where clause'

 

select os.orders_status_name, osh.date_added, osh.comments from orders_status os, orders_status_history osh where osh.orders_id = '325' and osh.orders_status_id = os.orders_status_id and os.language_id = '1' and os.public_flag = '1' order by os.date_added

 

[TEP STOP]

 

Code in file

 

<?php
 $statuses_query = tep_db_query("select os.orders_status_name, osh.date_added, osh.comments from " . TABLE_ORDERS_STATUS . " os, " . TABLE_ORDERS_STATUS_HISTORY . " osh where osh.orders_id = '" . (int)$HTTP_GET_VARS['order_id'] . "' and osh.orders_status_id = os.orders_status_id and os.language_id = '" . (int)$languages_id . "' and os.public_flag = '1' order by os.date_added");
 while ($statuses = tep_db_fetch_array($statuses_query)) {
echo '			  <tr>' . "\n" .
	 '				<td class="main" valign="top" width="70">' . tep_date_short($statuses['date_added']) . '</td>' . "\n" .
	 '				<td class="main" valign="top" width="70">' . $statuses['orders_status_name'] . '</td>' . "\n" .
	 '				<td class="main" valign="top">' . (empty($statuses['comments']) ? ' ' : nl2br(tep_output_string_protected($statuses['comments']))) . '</td>' . "\n" .
	 '			  </tr>' . "\n";
 }
?>

Edited by Jayhawk
Link to comment
Share on other sites

I fixed it.

 

I changed it to this:

 

<?php
 $statuses_query = tep_db_query("select os.orders_status_name, osh.date_added, osh.comments from " . TABLE_ORDERS_STATUS . " os, " . TABLE_ORDERS_STATUS_HISTORY . " osh where osh.orders_id = '" . (int)$HTTP_GET_VARS['order_id'] . "' and osh.orders_status_id = os.orders_status_id and os.language_id = '" . (int)$languages_id . "' order by osh.date_added");
 while ($statuses = tep_db_fetch_array($statuses_query)) {
echo '			  <tr>' . "\n" .
	 '				<td class="main" valign="top" width="70">' . tep_date_short($statuses['date_added']) . '</td>' . "\n" .
	 '				<td class="main" valign="top" width="70">' . $statuses['orders_status_name'] . '</td>' . "\n" .
	 '				<td class="main" valign="top">' . (empty($statuses['comments']) ? ' ' : nl2br(tep_output_string_protected($statuses['comments']))) . '</td>' . "\n" .
	 '			  </tr>' . "\n";
 }
?>

Link to comment
Share on other sites

  • 2 months later...

I simply can't get this to work, I must be doing something fundamentaly wrong as the the pop up page comes up blank regardless of whether I runit from checkout success or account history.

 

I've been through the install 4 or 5 times now and everything is in the right place, if anyone has any ideas it would be appreciated.

Link to comment
Share on other sites

  • 4 weeks later...

Hi, I installed this add on and it works fine. My problem is I want to use it with STS template module. When STS is enabled Print Order Receipt works ok up to the point when new pop up window for printing is open. In that new window I actually got STS template page instead of receipt ready to print. Clearly something needs to be modified in STS module. Any ideas what ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...