Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[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.

 

http://addons.oscommerce.com/info/2379

 

<?php
/*
 $Id: printorder.php,v 1.2 2004/08/25 23:03:52 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');
//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'));
//  }


 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['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
if($order->info['date_purchased']!=""){
    $mytimedifference=0;
    $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; ?>>
<head>

Link to comment
Share on other sites

  • 1 month later...
  • Replies 53
  • Created
  • Last Reply

Top Posters In This Topic

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

 

ref:

 

 

<?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>
       </td>
<?php //end add receipt// ?>

Edited by bhbilbao
Link to comment
Share on other sites

  • 11 months later...

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.

 

Thanks!

 

Lorraine

Link to comment
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.

 

Basically,

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

becomes

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

 

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

 

Lorraine

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...