Roaddoctor Posted June 14, 2007 Share Posted June 14, 2007 I could not find a thread for this contribution, so I am resurrecting it from the past. Contribution: Print Order Receipt Ver. 1.4 http://www.oscommerce.com/community/contributions,2379 I have installed the contribution and it works very well. Thank you to the original authors! I have made one enhancement, and have one bug that I need help to fix. I improved the way the Payment Method appears. rather than just a generic "Paid by credit card", use the following code to show the payment method, specific card type, and first and last 4 digits of the credit card. Much nicer. In catalog/print_order.php and catalog/print_order2.php FIND: <td class="main"><?php echo $order->info['payment_method']; ?> </td> REPLACE WITH: <!--<td class="main"><?php // echo $order->info['payment_method']; ?> </td> --> <?php // Better payment info ?> <?php if (tep_not_null($order->info['cc_number'])) { $this->cc_card_number_less_middle_digits = substr($order->info['cc_number'], 0, 4) . str_repeat('x', (strlen($order->info['cc_number']) - 8)) . substr($order->info['cc_number'], -4); ?> <td class="main"><b><?php echo ENTRY_PAYMENT_METHOD; ?></b> <?php echo $order->info['payment_method']; ?> (<?php echo $order->info['cc_type']; ?>)<br><b><?php echo ENTRY_PAYMENT_CC_NUMBER; ?></b> <?php echo $this->cc_card_number_less_middle_digits; ?><br><?php echo tep_draw_separator('pixel_trans.gif', '100%', '6'); ?></td> <?php } else { ?> <td class="main"><b><?php echo ENTRY_PAYMENT_METHOD; ?></b> <?php echo $order->info['payment_method']; ?></td> <?php } ?> <?php // END Better payment info ?> The bug fix I need help with has to do with the order number appearing In catalog/print_order.php the order number appears correctly. (this is the one viewed from My Account->Order history->Print Invoice) In catalog/print_order2.php (viewed from Checkout_Success) the order number does not appear at all Any help appreciated Quote -Dave Link to comment Share on other sites More sharing options...
Roaddoctor Posted June 15, 2007 Author Share Posted June 15, 2007 (edited) print_order2.php has an error in the display of the order number. Find: <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> Change to: <td class="main" colspan="2"><b><?php echo sprintf(HEADING_ORDER_NUMBER, $HTTP_GET_VARS['oID']) . ' <small>(' . $order->info['orders_status'] . ')</small>'; ?></b></td> the order number will now show properly Edited June 15, 2007 by Roaddoctor Quote -Dave Link to comment Share on other sites More sharing options...
Roaddoctor Posted June 15, 2007 Author Share Posted June 15, 2007 complete package updated v1.5 http://www.oscommerce.com/community/contributions,2379 Quote -Dave Link to comment Share on other sites More sharing options...
hhfriend Posted July 2, 2007 Share Posted July 2, 2007 complete package updated v1.5 http://www.oscommerce.com/community/contributions,2379 David, Thanks for the update! Do I need to install all the other updates besides yours, or is 1.5 a complete package as far as the file modifications go? I'm thinking I'll at least have to do the original, but what about v1.2, 1.3, 1.4, and 1.5 sorry about the confusion but I'm a NUB on this. and I would rather get it right the first time. Thanks, Henry Quote Link to comment Share on other sites More sharing options...
Roaddoctor Posted July 3, 2007 Author Share Posted July 3, 2007 David, Thanks for the update! Do I need to install all the other updates besides yours, or is 1.5 a complete package as far as the file modifications go? I'm thinking I'll at least have to do the original, but what about v1.2, 1.3, 1.4, and 1.5 sorry about the confusion but I'm a NUB on this. and I would rather get it right the first time. Thanks, Henry 1.5 is the complete package. No need to start with earlier version Quote -Dave Link to comment Share on other sites More sharing options...
ComicWisdom Posted August 16, 2007 Share Posted August 16, 2007 I certainly must have done something wrong because on both of the options I get blank pages. I went back through the instructions and found this. Is this where I made my mistake. The "should look like this" doesn't seem to give the results the instructions indicate. Am I misinterpreting it? ######################################################################################### in checkout_process.php right after.... $order_products_id = tep_db_insert_id(); ADD... //begin add receipt// tep_session_register('last_order'); $last_order = $insert_id; $oID = $last_order; //end add receipt// ________________________________________ should look like this.... tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); //begin add receipt// tep_session_register('last_order'); $last_order = $insert_id; $oID = $last_order; //end add receipt// ________________________________________ ################################################################################ ########## Quote Just between us, remember there are only 10 kinds of people in the world; those who understand binary and those who don't!! Remember, learning is a "do-it-yourself" experience; although, not necessarily a "do-it-BY-yourself" experience. The quickest way to learn is to forget to BACKUP! Link to comment Share on other sites More sharing options...
ctec2001 Posted August 22, 2007 Share Posted August 22, 2007 I followed the instructions and now get an error message as below: Fatal error: Call to a member function on a non-object in /home/morones5/public_html/test/checkout_process.php on line 203 Quote Do or Do Not, there is no try. Link to comment Share on other sites More sharing options...
ctec2001 Posted August 23, 2007 Share Posted August 23, 2007 I followed the instructions and now get an error message as below: Fatal error: Call to a member function on a non-object in /home/morones5/public_html/test/checkout_process.php on line 203 Nevermind, I was able to get the Print Order Receipt Contribution to work. There was a misunderstanding in the installation docs. Thank you. Great contribution. Quote Do or Do Not, there is no try. Link to comment Share on other sites More sharing options...
milkhouse Posted August 30, 2007 Share Posted August 30, 2007 Thanks for the contribution. I'm getting this error "popupPrintReceipt is not defined" [break on this error] null print_order2.php (line 1) in the Firefox Firebug console. I recall installing this as version 1.4 without these errors some time ago. Any help is appriciated. Quote Link to comment Share on other sites More sharing options...
ljk Posted November 7, 2007 Share Posted November 7, 2007 Hello, I don't seem to be getting out the credit card information in print_order2.php. Just getting the generic "Credit Card Payments". I have installed version 1.5, which has the update in it to get the credit card information printed. Do you need to be storing the credit card information in your db in order for this to work? I was also trying to get the comments/special instructions to show up on the invoice/receipt, but it always seems to come out blank. I was using this value: $order->info['comments'] to display the comments. It looked like orders.php was setting up the comments field, but nothing is being displayed. Anyone with any suggestions on either issue? Thanks Quote Link to comment Share on other sites More sharing options...
firefly11 Posted November 13, 2007 Share Posted November 13, 2007 hey, I'm getting a few problems: 1. On the account_history_info.php page, the order details are showing, except only the "U" in USA is showing for the country 2. On the pop-up print ready page, the same "u" thing is happening 3. on that print page, under Billing Info, it says "Payment Method", but nothing is showing up underneath that 4. Also, I'm getting the following error above the billing address: "Fatal error: Using $this when not in object context in /home/showkur8/public_html/lvf/vitaminshop/print_order.php on line 181" Any thoughts? Thx! Quote Link to comment Share on other sites More sharing options...
Roaddoctor Posted November 13, 2007 Author Share Posted November 13, 2007 I certainly must have done something wrong because on both of the options I get blank pages. I went back through the instructions and found this. Is this where I made my mistake. The "should look like this" doesn't seem to give the results the instructions indicate. Am I misinterpreting it? The correct "should look like this" - at least in my file checkout_process.php // Update products_ordered (for bestsellers list) tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); $sql_data_array = array('orders_id' => $insert_id, 'products_id' => tep_get_prid($order->products[$i]['id']), 'products_model' => $order->products[$i]['model'], 'products_name' => $order->products[$i]['name'], 'products_price' => $order->products[$i]['price'], 'final_price' => $order->products[$i]['final_price'], 'products_tax' => $order->products[$i]['tax'], 'products_quantity' => $order->products[$i]['qty']); tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array); $order_products_id = tep_db_insert_id(); //begin add receipt// tep_session_register('last_order'); $last_order = $insert_id; $oID = $last_order; //end add receipt// Quote -Dave Link to comment Share on other sites More sharing options...
Roaddoctor Posted November 13, 2007 Author Share Posted November 13, 2007 hey, I'm getting a few problems: 1. On the account_history_info.php page, the order details are showing, except only the "U" in USA is showing for the country 2. On the pop-up print ready page, the same "u" thing is happening 3. on that print page, under Billing Info, it says "Payment Method", but nothing is showing up underneath that 4. Also, I'm getting the following error above the billing address: "Fatal error: Using $this when not in object context in /home/showkur8/public_html/lvf/vitaminshop/print_order.php on line 181" Any thoughts? Thx! 1. My entries say United States, not USA or US so I have no idea 2. See #1 3. Does your copy of printorder.php look like this around line 174 to 192 <td class="main"><b><?php echo HEADING_PAYMENT_METHOD; ?></b></td> </tr> <tr> <!--<td class="main"><?php // echo $order->info['payment_method']; ?> </td> --> <?php // Better payment mod by BFD ?> <?php if (tep_not_null($order->info['cc_number'])) { $this->cc_card_number_less_middle_digits = substr($order->info['cc_number'], 0, 4) . str_repeat('x', (strlen($order->info['cc_number']) - 8)) . substr($order->info['cc_number'], -4); ?> <td class="main"><b><?php echo ENTRY_PAYMENT_METHOD; ?></b> <?php echo $order->info['payment_method']; ?> (<?php echo $order->info['cc_type']; ?>)<br><b><?php echo ENTRY_PAYMENT_CC_NUMBER; ?></b> <?php echo $this->cc_card_number_less_middle_digits; ?><br><?php echo tep_draw_separator('pixel_trans.gif', '100%', '6'); ?></td> <?php } else { ?> <td class="main"><b><?php echo ENTRY_PAYMENT_METHOD; ?></b> <?php echo $order->info['payment_method']; ?></td> <?php } ?> <?php // END Better payment mod by BFD ?> </tr> 4. See #3 - I can not duplicate the error. My line 181 is: $this->cc_card_number_less_middle_digits = substr($order->info['cc_number'], 0, 4) . str_repeat('x', (strlen($order->info['cc_number']) - 8)) . substr($order->info['cc_number'], -4); and its ok for me sorry I could not be of more help Quote -Dave Link to comment Share on other sites More sharing options...
firefly11 Posted November 15, 2007 Share Posted November 15, 2007 well, i fixed the U problem, but I'm still getting that error at line 181...yeah, my code looks exactly like yours... Quote Link to comment Share on other sites More sharing options...
optimist27 Posted November 26, 2007 Share Posted November 26, 2007 (edited) well, i fixed the U problem, but I'm still getting that error at line 181...yeah, my code looks exactly like yours... Yeah, I have the same problem with you on the line 181. Edited November 26, 2007 by optimist27 Quote Link to comment Share on other sites More sharing options...
optimist27 Posted November 26, 2007 Share Posted November 26, 2007 You can replace the variant $this in the line 181 and 183 to $order. I did and it works now ;). Quote Link to comment Share on other sites More sharing options...
firefly11 Posted November 26, 2007 Share Posted November 26, 2007 awesome, that worked! thanks... one last question....do you know how to change the code so only the last 4 digits of the cc # are showing? (right now it's the first and last 4..) thanks! Quote Link to comment Share on other sites More sharing options...
Guest Posted December 4, 2007 Share Posted December 4, 2007 How do you get it to print in landscape? Quote Link to comment Share on other sites More sharing options...
chameleon Posted February 7, 2008 Share Posted February 7, 2008 well, i fixed the U problem, but I'm still getting that error at line 181...yeah, my code looks exactly like yours... 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. Quote Link to comment Share on other sites More sharing options...
Guest Posted February 7, 2008 Share Posted February 7, 2008 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. Do you also only get the D whwn you okk at the print order in admin? Quote Link to comment Share on other sites More sharing options...
chameleon Posted February 7, 2008 Share Posted February 7, 2008 (edited) In the admin its all ok but in account_history_info.php i allthough have only the "D" Edited February 7, 2008 by chameleon Quote Link to comment Share on other sites More sharing options...
Guest Posted February 7, 2008 Share Posted February 7, 2008 In the admin its all ok but in account_history_info.php i allthough have only the "D" 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']); Quote Link to comment Share on other sites More sharing options...
chameleon Posted February 7, 2008 Share Posted February 7, 2008 thanks now ist working fine Quote Link to comment Share on other sites More sharing options...
Worrom Posted February 14, 2008 Share Posted February 14, 2008 This may be way out in left field, but it's worht a try. Does anyone know a way to configure the receipts to only include particular items rather than all items. Either by a common attribute, or product id, or anything. I am on a bit of a deadline for this projet so any help will be appreciated. Quote Link to comment Share on other sites More sharing options...
reformedman Posted February 16, 2008 Share Posted February 16, 2008 This may be way out in left field, but it's worht a try. Does anyone know a way to configure the receipts to only include particular items rather than all items. Either by a common attribute, or product id, or anything. I am on a bit of a deadline for this projet so any help will be appreciated. Could you be any more specific? Example perhaps? Quote man of a reformed faith. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.