bry21317 Posted December 27, 2006 Share Posted December 27, 2006 Here is what this does, its to select multiple items to batch print in an Oscommerce store. It is supposed to read the Order IDs and store them. What I have done is changed this to allow for printing the invoice or the packing list, but now its not showing but the first selected order. I have a feeling that what I did was moved the code around to add the If statement for to allow selecting for Batch Packing slip printing also. Here is the code that I messed with. [code=php:0]if($target_file == "packingslip") {include('print_batch_packing_slip.php'); } else {include('print_batch_invoice.php');[/code]I also moved some of the other php tags around, and I have a feeling that something is no longer in the php tags to allow it to know how many orders are actually selected and this is why it is working, but only showing the first order. Any help would be greatly apreciated.So somewhere in the code I have screwed up the ability of it to select multiple orders for printing. I am not sure how to fix this, if someone could please help me.[code]<?php/*batch-invoice-printing-v1.12004-12-18by PandA.nl*/require('includes/application_top.php');require(DIR_WS_CLASSES . 'currencies.php');include(DIR_WS_CLASSES . 'order.php');$target_file = $HTTP_POST_VARS['target_file'];unset($batch_order_numbers);if($HTTP_POST_VARS['batch_order_numbers']){foreach($HTTP_POST_VARS['batch_order_numbers'] as $order_number => $print_order) {$batch_order_numbers[] = $order_number;}} // begin error handlingif (!(is_array($batch_order_numbers))){exit('Error: no orders selected!');}//if (!(is_file($target_file))){//exit('Error: target file does not exist!');//}// end error handlingsort($batch_order_numbers);$number_of_orders = sizeof ($batch_order_numbers);;?><!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 . $autostatus; ?></title><link rel="stylesheet" type="text/css" href="includes/stylesheet.css"></head><body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF"><?php$firstinvoice=1;foreach ($batch_order_numbers as $order_number) {if($firstinvoice) {$firstinvoice = 0;} else {echo '<br style="page-break-before:always;">';}}$oID = $order_number;if($target_file == "packingslip") {include('print_batch_packing_slip.php'); } else {include('print_batch_invoice.php');}if($autoupdatestatus=='Yes') {tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . (int)$oID . "', '" . tep_db_input($autostatus) . "', now(), '" . tep_db_input('0') . "', '" . tep_db_input('') . "')");tep_db_query("update orders SET orders_status='" . tep_db_input($autostatus) . "' WHERE orders_id='" .$oID . "'"); }?></BODY></HTML><?phprequire(DIR_WS_INCLUDES . 'application_bottom.php');?>[/code]Sorry but we all have to learn somewhere. So I am trying to learn this, and working through it myself, I found out that with this one, I got a little over my head I think.Bryan Quote Link to comment https://forums.phpfreaks.com/topic/31997-problem-with-scripting-novice-in-php-is-what-the-real-problem-is/ 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.