Jump to content
Sign in to follow this  

[contribution] Print Order Receipt

Recommended Posts

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.

Hello I too had this issue with PWA so I created a timeout function on print_order2.php. I only changed a few lines so I attached the header to the contribution. Any feedback is welcomed...It's functional ... 2min timeout might need to be less but it is your call.




 $Id: printorder.php,v 1.2 2004/08/25 23:03:52 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License

//needs to be comment out for pwa shoppers
// if (!tep_session_is_registered('customer_id')) {
//   $navigation->set_snapshot();
//   tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
// }

 $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) . "'");
 $customer_info_query = tep_db_query("select customers_id from " . TABLE_ORDERS . " where orders_id = '". (int)$HTTP_GET_VARS['oID'] . "'");
 $customer_info = tep_db_fetch_array($customer_info_query);
//needs to be comment out for pwa shoppers
//  if ($customer_info['customers_id'] != $customer_id) {
//   tep_redirect(tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL'));
//  }


 $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['oID']), tep_href_link(FILENAME_ORDERS_PRINTABLE_INFO, 'order_id=' . $HTTP_GET_VARS['oID'], 'SSL'));

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

//allow users using purchase without an account to print out the invoice
    $mydatetime1 = strtotime(date('Y-m-d H:i:s'));
    $mydatetime2 = strtotime($order->info['date_purchased']);
    $mytimedifference = $mydatetime1 - $mydatetime2;    // echo $mytimedifference;
   if($mytimedifference>120){   //if current time is more than 2 minutes (120 seconds) after the order is processed we cant show details for some security due to pwa
      tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

//end of allow users using purchase without an account to print out the invoice

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>

Share this post

Link to post
Share on other sites

After clicking "Print Invoice" on checkout_success.php it opens a white page with empty data.





<?php //begin add receipt// ?>
<td><div style="float:left"><a href="javascript:popupPrintReceipt('<?php echo tep_href_link(FILENAME_ORDERS_PRINTABLE2, 'oID=' . $last_order); ?>')"><?php echo tep_image_button('button_print_order.gif', IMAGE_BUTTON_PRINT_ORDER) . '</a>'; ?></div><div style="float:right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></div>
<?php //end add receipt// ?>

Edited by bhbilbao

Share this post

Link to post
Share on other sites

How you fixed the "U" problem ?

Because i have the same error for me it only shows "D" instead of Deutschland.


Can you post your fix, please.


Hello I'm getting U instead of United Kingdom or UK can you tell me how you fixed your U problem please. Showing for me on Checkout and when viewed from Account.





Share this post

Link to post
Share on other sites

Try this, but backup first.


In catalog/includes/functions/general.php: undo the Use The Correct Country Name Value When Formatting Addresses change that appeared in the 20060817 patch.



$country = tep_output_string_protected($address['country']['title']);


if ($country == '') $country = tep_output_string_protected($address['country']);


You're brilliant! Helped me too! Many thanks!



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this