Jump to content
ugottasalsa

[Contribution] osC-PrintOrder with Store Logo v1.0

Recommended Posts

Hi Randy,

 

I have installed this contribution and followed the instructions and also double checked my work. I admin print invoice and packing slip works, except for PRINT_TITLE_ORDER_1 shows in the middle of the window, but I don't see any buttons for print for the customers, not in check_out _success or history info pages.

 

Any idea what have I missed? I'm using osC2.2 MS2

 

Thank you

 

 

I have managed to fix the print order in the customer screens, it was the gif file, the script was calling printorder.gif, but i had print_order.gif. The other problem still shows the PRINT_TITLE_ORDER in the middle of the window for the admin print invoice and packing slip pop-up windows.

Share this post


Link to post
Share on other sites

INVOICE DATE PURCHASE STAMP

 

I got this mod working, but only installed it on the catalog side for customer benefit. Our admin probably contains like 500 contributions so I didn't bother.

 

One thing that should be standard for the printable invoice would be to have the date of purchase on the invoice. We sell computers and a lot of manufacturers have rebate offers where you have to send a copy of your bill in. Because this is time sensitive the date needs to be on the invoice.

 

I tried to add a statement from the admin/orders.php file but it gives me an undefined varible and it's to late for me to figure it out.

 

Here is the tag that puts the date in the column of orders:

<td class="dataTableContent" align="center"><?php echo tep_datetime_short($orders['date_purchased']); ?></td>

 

Here is my nicely moded printorder.php file.

 

If you can make this work, you are a PHP God tonight.

 

PrintOrders.php BEGIN

---------------------------

<?php

/*

$Id: printorder.php,v 1.2 12/03/2003 randynewman

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 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'));

}

 

$customer_number_query = tep_db_query("select customers_id from " . TABLE_ORDERS . " where orders_id = '". tep_db_input(tep_db_prepare_input($HTTP_GET_VARS['order_id'])) . "'");

$customer_number = tep_db_fetch_array($customer_number_query);

 

$payment_info_query = tep_db_query("select payment_info from " . TABLE_ORDERS . " where orders_id = '". tep_db_input(tep_db_prepare_input($HTTP_GET_VARS['order_id'])) . "'");

$payment_info = tep_db_fetch_array($payment_info_query);

$payment_info = $payment_info['payment_info'];

 

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

 

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; ?>">

<title><?php echo TITLE . ' - ' . TITLE_PRINT_ORDER . ' ' . $HTTP_GET_VARS['order_id']; ?></title>

<base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="print.css">

<script language="JavaScript">

<!--

function Lvl_P2P(url,closeIt,delay){ //ver1.0 4LevelWebs

opener.location.href = url;

if (closeIt == true)setTimeout('self.close()',delay);

}

//-->

</script>

</head>

<body marginwidth="10" marginheight="10" topmargin="10" bottommargin="10" leftmargin="10" rightmargin="10">

<!-- body_text //-->

 

<?php

if ($HTTP_GET_VARS['order_id'] != $order_id) {

?>

 

<table width="600" border="0" align="center" cellpadding="2" cellspacing="0">

<tr>

<td align="center" class="main"><table align="center" width="100%" border="0" cellspacing="0" cellpadding="5">

<tr>

<td align="center" valign="middle" class="main"><?php echo TEXT_ORDER_ERROR; ?></td>

</tr>

<tr>

<td align="center" valign="middle" class="main"><a href="java script:;" onClick="Lvl_P2P('logout.php',true,0);return false"><?php echo tep_image(DIR_WS_IMAGES . 'close_window.gif', 'Close Window'); ?></a></td>

</tr>

</table></td>

</tr>

</table>

 

<?php

} else {

?>

 

<table width="600" border="0" align="center" cellpadding="2" cellspacing="0">

<tr>

<td align="center" class="main"><table align="center" width="100%" border="0" cellspacing="0" cellpadding="5">

<tr>

<td valign="top" align="left" class="main"><script language="JavaScript">

if (window.print) {

document.write('<a href="java script:;" onClick="java script:window.print()" onMouseOut=document.imprim.src="<?php echo (DIR_WS_IMAGES . 'printimage.gif'); ?>" onMouseOver=document.imprim.src="<?php echo (DIR_WS_IMAGES . 'printimage_over.gif'); ?>"><img src="<?php echo (DIR_WS_IMAGES . 'printimage.gif'); ?>" width="43" height="28" align="absbottom" border="0" name="imprim">' + '<?php echo IMAGE_BUTTON_PRINT; ?></a></center>');

}

else document.write ('<h2><?php echo IMAGE_BUTTON_PRINT; ?></h2>')

</script></td>

<td align="right" valign="bottom" class="main"><p align="right" class="main"><a href="java script:window.close();"><img src='images/close_window.jpg' border=0></a></p></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '15'); ?></td>

</tr>

<tr>

<td><table border="0" align="center" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td><table border="0" align="center" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td></td></tr>

<tr>

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

<td align="right" class="titleHeading"><b><?php echo TITLE_PRINT_ORDER . ' ' . $HTTP_GET_VARS['order_id']; ?></b></td>

</tr>

<tr>

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

<td align="right" valign="top" class="main">Date Purchased:</td>

</tr>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '20'); ?></td>

</tr>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td align="left" class="main"> </td>

</tr>

<tr>

<td align="center"><table align="center" width="100%" border="0" cellspacing="0" cellpadding="2">

<tr>

<td align="center" valign="top"><table align="center" width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor=#000000>

<tr>

<td align="center" valign="top"><table align="center" width="100%" border="0" cellspacing="0" cellpadding="2">

<tr class="dataTableHeadingRow">

<td class="dataTableHeadingContent"><b><?php echo ENTRY_SOLD_TO; ?></b></td>

</tr>

<tr class="dataTableRow">

<td class="dataTableContent"><?php echo tep_address_format($order->customer['format_id'], $order->customer, 1, ' ', '<br>'); ?></td>

</tr>

</table></td>

</tr>

</table></td>

<td align="center" valign="top"><table align="center" width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor=#000000>

<tr>

<td align="center" valign="top"><table align="center" width="100%" border="0" cellspacing="0" cellpadding="2">

<tr class="dataTableHeadingRow">

<td class="dataTableHeadingContent"><b><?php echo ENTRY_SHIP_TO; ?></b></td>

</tr>

<tr class="dataTableRow">

<td class="dataTableContent"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>'); ?></td>

</tr>

</table></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" width="100%" cellspacing="0" cellpadding="1" bgcolor=#000000>

<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_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'] . '<br>';

 

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 '<nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i><br></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($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";

}

?>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td align="right" colspan="7"><table border="0" cellspacing="0" cellpadding="2">

<tr>

<td><table border="0" width="100%" 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>

</table></td>

</tr>

</table>

<table width="600" border="0" align="center" cellpadding="2" cellspacing="0">

<tr>

<td class="main"><?php echo '<b>' . ENTRY_PAYMENT_METHOD . '</b> ' . $order->info['payment_method']; ?></td>

</tr>

<tr>

<td class="main"><b><?php echo $payment_info; ?></b></td>

</tr>

</table>

<table align="center">

<tr>

<td align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><b>Thank you for your business!</b><BR><BR></font></td>

</tr>

<tr>

<td align="center"><font size="3" face="Verdana, Arial, Helvetica, sans-serif"><b>Visit

us again online at:</b></font><font size="4" face="Verdana, Arial, Helvetica, sans-serif"><BR></B>

<font size="4">http://www.xxxxxxxx.com</font><BR>

</font><font size="3" face="Verdana, Arial, Helvetica, sans-serif"></B><b>for all your technology needs!</b></font></td>

</tr>

</table>

<?php

}

?>

<!-- body_text_eof //-->

<p> </p></body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

--------------

PrintOrders.php END

Share this post


Link to post
Share on other sites

Hello,

 

INVOICE DATE PURCHASE STAMP

 

I got this mod working, but only installed it on the catalog side for customer benefit. Our admin probably contains like 500 contributions so I didn't bother.

 

One thing that should be standard for the printable invoice would be to have the date of purchase on the invoice. We sell computers and a lot of manufacturers have rebate offers where you have to send a copy of your bill in. Because this is time sensitive the date needs to be on the invoice.

 

I tried to add a statement from the admin/orders.php file but it gives me an undefined varible and it's to late for me to figure it out..........

 

This can be done in the following way:

 

tep_datetime_short is not defined... so instead we use tep_date_long!

 

OPEN printorder.php and add the following line wherever you want the date to appear (make sure it is in a table though! ie within the <td> and </td> tages!):

 

<?php echo '<b>' . TEXT_DATE_ORDER_CREATED . '</b> ' . tep_date_long($order->info['date_purchased']); ?>

 

I added mine just below payment method so the code looks like this now:

 

<tr> 
         <td class="main"><?php echo '<b>' . ENTRY_PAYMENT_METHOD . '</b> ' . $order->info['payment_method']; ?></td>
       </tr>
       <tr>
         <td class="main"><?php echo '<b>' . TEXT_DATE_ORDER_CREATED . '</b> ' . tep_date_long($order->info['date_purchased']); ?></td>
       </tr>

 

NEXT you need to define TEXT_DATE_ORDER_CREATED, so in catalog/includes/languages/english/printorder.php add:

 

define('TEXT_DATE_ORDER_CREATED', 'Date Purchased:');

 

You can define it to say whatever!

 

The date will be shown like this example: Friday, 09 November 2004

 

Let me know if it works!

 

Regards

 

Jiten

Share this post


Link to post
Share on other sites

Jiten

works perfect! Thank you So much!

 

Was wondering if there was a way to format long_date to appear like Thursday, May 10, 2004?

Share this post


Link to post
Share on other sites

I think that you can define how the date is shown in:

 

catalog/includes/languages/english.php

 

Look for:

 

define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime()

 

Try swapping %d and %B with each other... see if it works. Sorry I haven't tested so cannot be 100% sure if it will work. You may have to otherwise mess around with the database!

 

Regards

 

Jiten

Share this post


Link to post
Share on other sites

Hi,

 

Hopefully someone can help me with this problem.

 

I have found out why the invoice and packing slip buttons don't work in the admin module.

 

It is beacuse I am running my whole admin site as HTTPS, if I right click on the invoice button and open a new window, then remove the javascript part of the URL and change the URL to the standard web site the invoice will appear.

 

I know I can hard code the buttons to only go to the standard site instead of HTTPS, but I would rather get it working with SSL.

 

I hope someone can find a cure.

 

Regards,

 

Tom.

Share this post


Link to post
Share on other sites

From an earlier post (page 5, I think):

Question:

Invoices from admin is printed without order No's. Instead of printing eg. "Order # 87" it prints "TITLE_PRINT_ORDER #". The file invoice.php is exactly identical to the one included in the contribution, so I simply don't know where to look.

 

Answer:

You are missing a "defines" statement. If you review the installation procedure, you will likely find that you needed to add at least one "defines" statement at install. Make sure all of them are present and in the correct file or folder.

That should take care of your problem.

 

I am having the same issue, and followed the instructions. Where exactly should a change be made?

 

You are missing a "defines" statement.

Please give a specific file where a define statement should be.

 

Here are the 2 define statements in the installation instructions:

 

########## ADMIN/INCLUDES/LANGUAGES/ENGLISH/PACKINGSLIP.PHP ##########

Add this to admin/includes/languages/english/packingslip.php ...

define('PRINT_ORDER_TITLE', 'Order#');

########## END ###

########## ADMIN/INCLUDES/LANGUAGES/ENGLISH/INVOICE.PHP ##########

Add this to admin/includes/languages/english/invoice.php ...

define('PRINT_ORDER_TITLE', 'Order#');

 

Where EXACTLY does another define statement need to go? Could someone also provide exact syntax as well? I am no PHP person by any means, but I can copy and paste with the best of 'em. ;)

Share this post


Link to post
Share on other sites

I have fixed the problem with the admin print invoice and packing slip,

 

PRINT_ORDER_TITLE was showing in the center of the pop-up, it turns out that the define statements were in reverse

 

CODE  
########## ADMIN/INCLUDES/LANGUAGES/ENGLISH/PACKINGSLIP.PHP ##########

Add this to admin/includes/languages/english/packingslip.php ...

define('PRINT_ORDER_TITLE', 'Order#');

########## END ###

########## ADMIN/INCLUDES/LANGUAGES/ENGLISH/INVOICE.PHP ##########

Add this to admin/includes/languages/english/invoice.php ...

define('PRINT_ORDER_TITLE', 'Order#');

 

and it should be:

 

CODE  
########## ADMIN/INCLUDES/LANGUAGES/ENGLISH/PACKINGSLIP.PHP ##########

Add this to admin/includes/languages/english/packingslip.php ...

define('TITLE_PRINT_ORDER', 'Order#');

########## END ###

########## ADMIN/INCLUDES/LANGUAGES/ENGLISH/INVOICE.PHP ##########

Add this to admin/includes/languages/english/invoice.php ...

define('TITLE_PRINT_ORDER', 'Order#');

 

 

Note the TITLE is infront

Share this post


Link to post
Share on other sites

I just have this problem :blink:

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

 

select payment_info from orders where orders_id = '27'

 

[TEP STOP]

 

yes I have run the sql query.

Share this post


Link to post
Share on other sites

Okay... so you ran the SQL query... did you verify that you actually have a payment_info field in the Orders table?

 

-R


"Courage is not the absence of fear, but the awareness of fear and the ability to get past it."

 

It's difficult to diagnose an issue when the patient says, "I have this pain right here Doc, what do you think it is?"

Share this post


Link to post
Share on other sites

Hi. yes I did.

 

my post was incorrect.

 

When I add the code

'billing_country' => $order->billing['country']['title'], 
                         'billing_address_format_id' => $order->billing['format_id'], 
                         'payment_method' => $order->info['payment_method'], 
                         'payment_info' => $GLOBALS['payment_info'],

to my checkout process. When the customer clicks to confirm their order this error occurs.

 

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

insert into orders (customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, payment_info, cc_type, cc_owner, cc_number, cc_expires, date_purchased, orders_status, currency, currency_value) values ('2',  'Direct Credit', '
Please use the following details to transfer your total order value:

Account No.:    
Account Name:      
Branch:          

Thanks for your order which will ship immediately we receive payment in the above account.', '', '', '', '', now(), '1', 
[TEP STOP]

 

I still receive the error I first mentioned in admin when I try to view an invoice/packing slip.

 

I am sure it must be something silly that I have done. :) Have you seen this before?

Share this post


Link to post
Share on other sites

I am receiving the following error message as well when I add in the following code to CATALOG/CHECKOUT_PROCESS.PHP:

'billing_country' => $order->billing['country']['title'], 
                        'billing_address_format_id' => $order->billing['format_id'], 
                        'payment_method' => $order->info['payment_method'], 
                        'payment_info' => $GLOBALS['payment_info'],

 

Error:

 

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

select customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, comments, currency, currency_value, date_purchased, orders_status, last_modified from orders where orders_id = '7'

[TEP STOP]

 

This sounds similar to Trouble's problem 2 posts above. Any ideas how to fix this?

Share this post


Link to post
Share on other sites

Also, I have noticed that the shipping logic has suddenly changed. A test item that used to cost $3.95 to ship now costs $4.90. Can all of this change just by adding in those lines in the checkout_process.php file?

Edited by Karlin

Share this post


Link to post
Share on other sites

I am also using this mod, and installed a couple after. On the CHECKOUT_SUCCESS PAGE, everything looks fine until I click on "Print Order Details. Then in the popup box I get:

 

SOLD TO:

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /www/c/mysite/htdocs/catalog/includes/functions/general.php on line 49

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /www/c/mysite/htdocs/catalog/includes/functions/general.php on line 49

John Doe

123 Main Street

Bronx, New York 10312

 

But when I view these order details from Account history, it works fine.

I've searched through the forums to try and find a solution with no luck.

 

Anyone please?

Share this post


Link to post
Share on other sites

Randy, great contrib! I just setup the print order with store logo v2.0 and I have something of a fix/bug list and a question. Here are the problems I ran into:

 

1) button_print_order.gif should be button_printorder.gif in catalog/includes/languages/english/images/buttons

2) TITLE_PRINT_ORDER should be PRINT_ORDER_TITLE in catalog/admin/invoice.php in two locations

3) TITLE_PRINT_ORDER should be PRINT_ORDER_TITLE in catalog/admin/packingslip.php in two locations

4) Date information should be included in the order and invoice forms, Jiten came up with a great way to do this in this thread:

 

OPEN printorder.php and add the following line wherever you want the date to appear (make sure it is in a table though! ie within the <td> and </td> tages!):

 

CODE?

<?php echo '<b>' . TEXT_DATE_ORDER_CREATED . '</b> ' . tep_date_long($order->info['date_purchased']); ?>

 

I added mine just below payment method so the code looks like this now:

 

CODE?

<tr>

? ? ? ?  <td class="main"><?php echo '<b>' . ENTRY_PAYMENT_METHOD . '</b> ' . $order->info['payment_method']; ?></td>

? ? ?  </tr>

? ? ?  <tr>

? ? ? ?  <td class="main"><?php echo '<b>' . TEXT_DATE_ORDER_CREATED . '</b> ' . tep_date_long($order->info['date_purchased']); ?></td>

? ? ?  </tr>

 

NEXT you need to define TEXT_DATE_ORDER_CREATED, so in catalog/includes/languages/english/printorder.php add:

 

CODE?

define('TEXT_DATE_ORDER_CREATED', 'Date Purchased:');

 

5) When in an https session, the print order javascript form will be spawned as an http session. I think the fix was in this thread but I haven't gotten to it yet.

6) A user must login after their session times out. Because the invoice/order information is sent to customers in emails, a user should be able to simply click on the link and not have to worry about login info.

 

 

I am running the simple template system which intercepts the calaog/printorder html so that all a customer gets is small version of my site with no order information (this does not happen on the admin panel). I have yet to figure out a good way to stop this from happening. Anyone know a way to get around this?

Edited by pcs

Share this post


Link to post
Share on other sites

I got almost everything working the way I want, here is some more of the things I did:

 

1) account_history_info.php and orders.php -> make scrollbar = yes, height 800 for the java popup window. If you have even a medium sized logo and order information you will want larger than the default 500 pixels tall and for those people who want to order many items, it should be scrollable.

2) For those using STS, this is the way around it from Brian Gallagher

 

In sts_display_output.php change these lines:

 

CODE

// This is required to prevent display of standard page elements (header, footer, etc) from the template and allow javascript code to run properly

if (strpos($scriptname, "popup") !== false || strpos($scriptname, "info_shopping_cart") !== false) {

$display_normal_output = 1;

$display_template_output = 0;

}

 

 

to this:

 

 

QUOTE

// This is required to prevent display of standard page elements (header, footer, etc) from the template and allow javascript code to run properly

if (strpos($scriptname, "popup") !== false || strpos($scriptname, "info_shopping_cart") !== false || strpos($scriptname, "printorder.php") !== false) {

  $display_normal_output = 1;

  $display_template_output = 0;

}

 

 

That should keep STS from using the template on the printorder file.

 

- Brian

3) Add cusomter email and phone number to the order form and invoice:

Directly below these lines:

<tr class="dataTableRow">

                <td class="dataTableContent"><?php echo tep_address_format($order->customer['format_id'], $order->customer, 1, ' ', '<br>'); ?></td>

              </tr>

 

Insert these lines:

<tr class="dataTableRow">

                <td class="dataTableContent"><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td>

              </tr>

              <tr class="dataTableRow">

                <td class="dataTableContent"><?php echo ' <b>Telephone#</b>' . '<br> ' . $order->customer['telephone']; ?></td>

              </tr>

              <tr class="dataTableRow">

                <td class="dataTableContent"><?php echo ' <b>eMail Address:</b>' . '<br> ' . $order->customer['email_address']; ?></td>

              </tr>

4) The close window image does not correctly show up during a failed print order attempt: In the security section of printorder.php where you see these lines:

<tr>

<td align="center" valign="middle" class="main"><?php echo TEXT_ORDER_ERROR; ?></td>

</tr>

<tr>

<td align="center" valign="middle" class="main"><a href="java script:;" onClick="Lvl_P2P('logout.php',true,0);return false"><?php echo tep_image(DIR_WS_IMAGES . 'close_window.gif', 'Close Window'); ?></a></td>

 

Change close_window.gif to close_window.jpg

5) For those using https, the javascript window can be spawned as an http session from account history and at the end of checkout. This poses both security and login problems. Greymist came up with a fix to put in account_history_info.php and checkout_success.php:

I managed to get it to work by changing the code to the same as the back button.

 

Pasted Code:

 

<td align="right" class="main"><?php echo '<a href="java script:popupWindow(\'' . (HTTP_SERVER . DIR_WS_CATALOG . FILENAME_ORDERS_PRINTABLE) . '?' . (tep_get_all_get_params(array('order_id')) . 'order_id=' . $HTTP_GET_VARS['order_id']) . '\')">' . tep_image_button('button_printorder.gif', IMAGE_BUTTON_PRINT_ORDER) . '</a>'; ?></td>

 

New Code:

 

<td align="right" class="main"><?php echo '<a href="java script:popupWindow(\'' . tep_href_link(FILENAME_ORDERS_PRINTABLE, tep_get_all_get_params(), 'SSL') . '\')">' . tep_image_button('button_printorder.gif', IMAGE_BUTTON_PRINT_ORDER) . '</a>'; ?></td>

Share this post


Link to post
Share on other sites

After installing this contribution, I got this error when I try to edit an order in the admin panel:

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

 

select products_description as desc_info from products_description where products_id =

 

[TEP STOP]

 

 

 

any ideas?????


"Faster than light...."

Share this post


Link to post
Share on other sites

Hey James, love your additions.

 

I have gotten most to work except the checkout_success. It is still possible when on this page to change the number in the url to an earlier number, hit go, and then hit print order button and someone elses invoice comes up.

Maybe I did something wrong but I double checked and I believe I changed the right code.

 

Any suggestions?

 

Also,I don't want to call invoice from admin as suggested in earlier posts as this would give away the path to my admin, which is supposed to be a secret.

 

This will be a great contra once all the bugs are killed.

 

Dappa Dan


I want to believe.

Share this post


Link to post
Share on other sites

Dan,

 

This contrib has 3 distinct forms for order printing. There is /catalog/print_order.php, /catalog/admin/invoice.php and /catalog/admin/packingslip.php. In my opinion, you NEVER want to define globals and allow customer access to the invoice.php or packingslip.php. In fact, everything in the admin directory should have .htaccess security or better.

 

Printorder.php has two security sections of code. The first insures that the user is valid for the session and requires a login if the user is not already logged in:

 

  if (!tep_session_is_registered('customer_id'))

  {

    $navigation->set_snapshot();

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

  }

 

Randy recently added another security feature that is supposed to close the window if the incorrect user is able to access the orders of others while logged in (by changing the orderid in the shortcut for the javascript window). As you have pointed out, this feature does not appear to work and still allows a user who is logged in to view other customers orders.

 

<script language="JavaScript">

<!--

function Lvl_P2P(url,closeIt,delay){ //ver1.0 4LevelWebs

    opener.location.href = url;

if (closeIt == true)setTimeout('self.close()',delay);

}

-->

</script>

 

I have not addressed this security hole because I allow guest login purchases and as such have had to remove all security on the order printing information (the guest is not logged in but should still be able to print the invoice so there cannot be any user validation). So I don't have any suggestions for you at this time, though if I get time I may take another look at it in the future.

Share this post


Link to post
Share on other sites
I am also using this mod, and installed a couple after. On the CHECKOUT_SUCCESS PAGE, everything looks fine until I click on "Print Order Details. Then in the popup box I get:

 

SOLD TO:

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /www/c/mysite/htdocs/catalog/includes/functions/general.php on line 49

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /www/c/mysite/htdocs/catalog/includes/functions/general.php on line 49

John Doe

123 Main Street

Bronx, New York 10312

 

But when I view these order details from Account history, it works fine.

I've searched through the forums to try and find a solution with no luck.

 

Anyone please?

 

 

I am haveing this same problem.

How do we fix it?

 

Dappa Dan


I want to believe.

Share this post


Link to post
Share on other sites

If anyone is interested, I made a print order button to use with The XP button style.

 

button_printorder.gif

 

Also, has anyone else been having trouble using this with popup blockers? If I change the javascript command from windowPopop to just windowOpen, would that eliminate the problem?

Share this post


Link to post
Share on other sites

Does anyone know how I can get the USPS, FedEx, and UPS Tracking Numbers contrib to work with this? I want to have the Tracking Number show up on the invoice and packing slips.

 

I tried getting it to print into the form right next to where it prints the payment method, but nothing shows up. I get no errors or anything, but the tracking numbers do not print.

Share this post


Link to post
Share on other sites

If anyone is still experiencing this error

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /www/c/mysite/htdocs/catalog/includes/functions/general.php on line 49

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /www/c/mysite/htdocs/catalog/includes/functions/general.php on line 49

 

I found that this happens if the order_id hasn't been passed to checkout_sucess.php as a parameter. This happens for me on all PayPal payments.

 

The fix is to change the link to the Print Order button code in checkout_sucess.php so that it changes from

<td align="right" class="main"><?php echo '<a href="javascript:popupWindow(\'' . tep_href_link(FILENAME_ORDERS_PRINTABLE, tep_get_all_params(), 'SSL') . '\')">' . tep_image_button('button_print_order.gif', IMAGE_BUTTON_PRINT_ORDER) . '</a>'; ?></td>

to

<td align="right" class="main"><?php echo '<a href="javascript:popupWindow(\'' . tep_href_link(FILENAME_ORDERS_PRINTABLE, 'order_id=' . $orders['orders_id'], 'SSL') . '\')">' . tep_image_button('button_print_order.gif', IMAGE_BUTTON_PRINT_ORDER) . '</a>'; ?></td>

 

Cheers

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

×