BlindSide:
The "Batch Form Print" feature was a port from OSC. I know the solution isn't eloquent, but it was there and it worked. A CSS-powered option would be far better, I agree. You got some spare hours in the day I could use? :blink:
I have changed the code to work using css adding page breaks. It required a rewrite of batch_forms() and minor changes to the super_packingslip, super_invoice and super_shipping_label files.
The changes to the files mentioned above are: require() must be changed to require_once() and a conditional around the HTML header and closing tags must be added using:
<?php if ($_GET['pagebreaks'] != 1) { ?>
also you need to add global $db; to super_invoices.php.
function batch_forms($target_file, $selected_oids, $num_copies = 1)
{
// begin error handling
if (!is_array($selected_oids)) { exit(ERROR_NO_ORDERS); }
if (!is_file($target_file)) { exit(ERROR_NO_FILE); }
// end error handling
unset($batch_order_numbers);
foreach ($selected_oids as $order_number => $print_order)
{
$batch_order_numbers[] = $order_number;
}
sort($batch_order_numbers);
if (file_exists(DIR_WS_LANGUAGES . $_SESSION['language'] . '/'. $target_file))
{
include_once(DIR_WS_LANGUAGES . $_SESSION['language'] . '/'. $target_file);
}
?>
<!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>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/menu.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<?php
$_GET['pagebreaks'] = 1;
foreach ($batch_order_numbers as $order_number)
{
$_GET['oID'] = $order_number;
for ($copies = 1; $copies <= $num_copies; ++$copies)
{
include($target_file);
echo '<div style="page-break-after: always;"></div>';
}
}
?>
</body>
</html>
<?php
require(DIR_WS_INCLUDES . 'application_bottom.php');
}
Download changes at: http://www.lurkerfilms.com/ftp/superorder_update.zip