Jump to content
Sign in to follow this  
defender39

Batch Order Center Update 1.1

Recommended Posts

Another problem.

 

I have just installed all this contribution, but when i press the Batch print under /admin/tools, an empty page comes up. Any ieas as to where to look?

 

Best regards

Palle

Share this post


Link to post
Share on other sites

Hello.

 

This is a great contributions. Just one question: Did someone solve the problem that when printing 10 labels the first disappear and then only 9 will Appear ?

Share this post


Link to post
Share on other sites
Just one question: Did someone solve the problem that when printing 10 labels the first disappear and then only 9 will Appear ?

 

Same question here...

Did someone solve this problem?

Share this post


Link to post
Share on other sites

I installed Version 1.1 with the fix but I get this message:

 

There were no orders selected for export, try changing your order options.

 

I inserted all dates from 2000-01-01 upt ot 2006-10-14 and changed nothing else.

 

I can see one order made 2006-04-25, but the tool can not find it... :'(


OSC Webmakers Edition modiefied with many other contribs and enhancements.

+ STS 4.5.7 for 2.2MS2 and RC1

Share this post


Link to post
Share on other sites

I need to be able to export to an excel file a report with

 

Customer order #

Shipping Address

Quantity

.

.

.

 

 

So our fulfillment house can read and extract the info from this file

Share this post


Link to post
Share on other sites

For anyone having problems with this contribution not functioning on newer mySQL servers (the date search not finding results even when it should do), it is very simple to resolve.

 

The query does not need to be altered much, you only need to add a blank space into the code and it functions.

 

The answer has been partly fixed earlier in this thread: but the earlier solution altered the SQL query, where it did not need altering.

 

The problem seems to be that the date format set for the <date to> field was incorrectly structured, which seemed to work in mysql 3.x but not in mysql 4.x

 

After some testing of the query itself, if you make the following change to catalog/admin/batch_print.php on line 79:

 

$orders_query = tep_db_query("select o.orders_id,h.comments,MIN(h.date_added) from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_STATUS_HISTORY . " h where o.date_purchased between '" . tep_db_input($startdate) . "' and '" . tep_db_input($enddate) . "23:59:59' and h.orders_id = o.orders_id" . $pull_w_status . $get_customer_comments . ' group by o.orders_id');

 

to this:

 

$orders_query = tep_db_query("select o.orders_id,h.comments,MIN(h.date_added) from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_STATUS_HISTORY . " h where o.date_purchased between '" . tep_db_input($startdate) . "' and '" . tep_db_input($enddate) . " 23:59:59' and h.orders_id = o.orders_id" . $pull_w_status . $get_customer_comments . ' group by o.orders_id');

 

The only change is that a space has been inserted before 23:59:59 , this allows the query to run correctly. It must have been a bug in mysql 3.x that allowed it run .. I can't say.

 

Make the above change and run the date search, it worked for me :)


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

Share this post


Link to post
Share on other sites

Can anyone help me edit the integrated packing template?

 

i've tried and can't seem to figure out what i'm doing...

 

here's a picture of what it currently looks like:

 

http://www.jtstech.com/batch_print.jpg

 

Basically I'm trying to get it to print on some custom labels I have. The labels are: http://www.pcform.com/intlabels.asp It's label LS-B

 

It has two labels at the top. The details of the labels are:

 

Size of Sheet: 8 1/2" X 11"

Number of Labels: 2

Label 1 Size: 4" X 2 1/2"

Distance From Left Edge: 3/16"

Distance From Top Edge: 7/8"

 

Label 2 Size: 4" X 2 1/2"

Distance From Left Edge: 4 11/32"

Distance From Top Edge: 7/8"

 

 

I have edited the form in Illustrator and saved as a pdf to the way I want it to look.

 

it's here: www.jtstech.com/batch_orders.pdf

 

Here is my current template

 

<?php
// set paper type and size
if ($pageloop == "0") {
$pdf = new Cezpdf(Letter,portrait);
} else {

define('LEFT_MARGIN','30');
// The small indents in the Sold to: Ship to: Text blocks
define('TEXT_BLOCK_SMALL_INDENT', '5');
define('TEXT_BLOCK_INDENT', '25');

define('SHIP_TO_COLUMN_START','330');
define('MIDDLE_COLUMN_START','250');
define('RIGHT_COLUMN_START','450');
// This changes the 'Total', 'Sub-Total', 'Tax', and 'Shipping Method' text block
// position, for example if you choose to make the text a bigger font size you need to 
// tweak this value in order to prevent the text from clashing together
define('PRODUCT_TOTAL_TITLE_COLUMN_START','400');
define('RIGHT_MARGIN','30');
define('LINE_LENGTH', '552');
// If you have attributes for certain products, you can have the text wrap
// or just be written completely on one line, with the text wrap disabled
// it makes the tables smaller appear much better, of course that is only my opinion
// so I made this variable if anyone would like it to wrap.
define('PRODUCT_ATTRIBUTES_TEXT_WRAP', false);
// This sets the space size between sections
define('SECTION_DIVIDER', '15');
// Product table Settings
define('TABLE_HEADER_FONT_SIZE', '8');
define('TABLE_HEADER_BKGD_COLOR', DARK_GREY);
define('PRODUCT_TABLE_HEADER_WIDTH', '530');
// This is more like cell padding, it moves the text the number
// of points specified to make the rectangle appear padded
define('PRODUCT_TABLE_BOTTOM_MARGIN', '2');
// Tiny indent right before the product name, again more like
// the cell padding effect
define('PRODUCT_TABLE_LEFT_MARGIN', '2');
// Height of the product listing rectangles
define('PRODUCT_TABLE_ROW_HEIGHT', '11');
// The column sizes are where the product listing columns start on the
// PDF page, if you make the TABLE HEADER FONT SIZE any larger you will
// need to tweak these values to prevent text from clashing together
define('PRODUCTS_COLUMN_SIZE', '215');
define('PRODUCT_LISTING_BKGD_COLOR',GREY);
define('MODEL_COLUMN_SIZE', '62');
define('PRICING_COLUMN_SIZES', '52');

define('SMALL_LEADING', '6');
define('IPS_LEADING', '9');
define('LABEL_LEADING', '12');
define('IPS_FONT_SIZE', '8');
define('LABEL_FONT_SIZE', '12');
define('SENDER_TICKET_SIZE', '8');
define('SENDER_FONT_SIZE', '6');
define('SENDER_SMALL_FONT_SIZE', '5');
define('TICKET_FONT_SIZE', '7');
// This should go in the language file
$vilains = array("à", "á",  "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "÷", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ", "ß","'", " ", "à", "á", "ã","ä", "&Arond;", "è", "æ", "ê", "ë", "ì", "í", "Í", "î", "ï", "ò", "ó", "ô", "õ", "ö", "ø", "ù", "ú", "û", "ü", "ñ", "ç", "ý", "<",">", "&");
$cools = array('à','á','â','ã','ä','å','æ','ç','è','é','ê','ë','ì','í','î','ï','ð','ñ','ò','ó','ô','õ','ö','÷','ø','ù','ú','û','ü','ý','þ','ÿ','ß','\'', ' ','à','á','ã','ä','å','è','æ','ê','ë','ì','í','î','Î','ï','ò','ó','ô','õ','ö','ø','ù','ú','û','ü','ñ','ç','ý','<','>','&');

$currencies = new currencies();

$pdf->selectFont(BATCH_PDF_DIR . 'Helvetica.afm');
$pdf->setFontFamily(BATCH_PDF_DIR . 'Helvetica.afm');
// set up delivery address array
$address_array=explode('<br>',tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br>'));

if (SHIP_FROM_COUNTRY == $address_array[count($address_array)-1]) {
$address_array[count($address_array)-1] = '';
}
$delivery_address_array = array();
$i = 0;
foreach ($address_array as $key => $value) {
 if ((!is_null($value))&& ($value !== "")) {
$delivery_address_array[$i] = $value;
$i++;
 }
}

// set up billing address array
$address_array=explode('<br>',tep_address_format($order->billing['format_id'], $order->billing, 1, '', '<br>'));
$lines = count($address_array)-1;
if (SHIP_FROM_COUNTRY == $address_array[$lines]) {
$address_array[$lines] = '';
}
$billing_address_array = array();
$i = 0;
foreach ($address_array as $key => $value) {
 if ((!is_null($value))&& ($value !== "")) {
$billing_address_array[$i] = $value;
$i++;
 }
}

$address_array=explode('<br>', str_replace("\r\n", "<br>", STORE_NAME_ADDRESS));
$i = 0;
//The first $key number is the number of lines in your store name and address excluding the telephone number at the bottom.
//The second $key number is the number of lines in your store name and address excluding telephone number and country.
foreach ($address_array as $key=>$value)  {
if (((SHIP_FROM_COUNTRY != $order->delivery['country']) && ($key < 5)) || ($key < 4))
{
$store_address_array[$i] = $value;
  $i++;
}
}
$y=730;
$pos = $y;



foreach ($delivery_address_array as $key=>$value)  {
$pdf->addText(LEFT_MARGIN,$pos -= SMALL_LEADING,SENDER_SMALL_FONT_SIZE,$value);
}

$pos=$y;

//  $address_array=explode('<br>', str_replace("\r\n", "<br>", STORE_NAME_ADDRESS));
foreach ($store_address_array as $key=>$value)  {
// echo $value.'<br>';
$pdf->addText(SHIP_TO_COLUMN_START,$pos -= SMALL_LEADING,SENDER_SMALL_FONT_SIZE,$value);
}
  $y-=75;
// company name and details pulled from the my store address and phone number
// in admin configuration mystore 
$pdf->setStrokeColor(0,0,0);
$pdf->setLineStyle(1);
$pdf->roundedRectangle(28,580,230,120,10,$f=0);

// order number
//$y = $pdf->ezText("" . TEXT_ORDER_NUMBER . " " . $orders['orders_id'] ."\n\n",SENDER_FONT_SIZE);
$indent =  LEFT_MARGIN +  TEXT_BLOCK_SMALL_INDENT;
$pdf->addText($indent,$y,SUB_HEADING_FONT_SIZE,"<b>" . TEXT_TO . "</b>");
//$y = $pdf->ezText(STORE_NAME_ADDRESS,GENERAL_FONT_SIZE);
$pos = $y;
$indent =  LEFT_MARGIN +  TEXT_BLOCK_INDENT;

foreach ($store_address_array as $key=>$value)  {
$pdf->addText($indent,$pos -= LABEL_LEADING,LABEL_FONT_SIZE,"<b>".$value."</b>");
}


// logo image  set to right of the above .. change first number to move sideways	
// $pdf->addJpegFromFile(BATCH_PRINT_INC . 'templates/' . 'invoicelogo.jpg',365,730,85,85);


$pdf->setStrokeColor(0,0,0);
$pdf->setLineStyle(1);
$pdf->roundedRectangle(330,580,260,120,10,$f=0);


// ship to info in right column
$indent = SHIP_TO_COLUMN_START + TEXT_BLOCK_SMALL_INDENT;
$pdf->addText($indent,$y,SUB_HEADING_FONT_SIZE,"<b>" . TEXT_TO . "</b>");

$pos = $y;
$indent = SHIP_TO_COLUMN_START + TEXT_BLOCK_INDENT;


foreach ($delivery_address_array as $key=>$value)  {
$pdf->addText($indent,$pos -= LABEL_LEADING,LABEL_FONT_SIZE,"<b>".$value."</b>");
}
$y -=125;
// order number
$pdf->addText(LEFT_MARGIN + 55,$y,TICKET_FONT_SIZE,"" . TEXT_RETURNS_LABEL . " " . $orders['orders_prefix'] . $orders['orders_id'] ."");

$pdf->addText(SHIP_TO_COLUMN_START + 70,$y,TICKET_FONT_SIZE,"" . TEXT_SHIPPING_LABEL . " " . $orders['orders_prefix'] . $orders['orders_id'] ."");

// line between header order number and order date
$y -=20;
  $pdf->addText(LEFT_MARGIN,$y,TICKET_FONT_SIZE, TEXT_RETURNS);
 $y -=10;
$pdf->setLineStyle(1);
$pdf->line(LEFT_MARGIN,$y,LINE_LENGTH,$y);
$pdf->ezSetY($y);
$dup_y = $y;

// order number
$y = $pdf->ezText("<b>" . TEXT_ORDER_NUMBER . " </b>" . $orders['orders_prefix'] . $orders['orders_id'] ."\n\n",SUB_HEADING_FONT_SIZE);

// order date
if ($HTTP_POST_VARS['show_order_date']) {
$pdf->ezSetY($dup_y);
$pdf->ezText("<b>" . TEXT_ORDER_DATE . " </b>" . date(TEXT_ORDER_FORMAT, strtotime($order->info['date_purchased'])) ."\n\n",SUB_HEADING_FONT_SIZE,array('justification'=>'right'));
}

$y -= 10;


//left rounded rectangle around sold to info
$pdf->setStrokeColor(0,0,0);
$pdf->setLineStyle(1);
$pdf->roundedRectangle(28,450,190,100,10,$f=0);


// sold to info in left rectangle	
$pdf->addText(LEFT_MARGIN,$y,SUB_HEADING_FONT_SIZE,"<b>" . ENTRY_SOLD_TO . "</b>");

$pos = $y;
$indent = LEFT_MARGIN + TEXT_BLOCK_INDENT;

//  $address_array=explode('<br>',tep_address_format($order->billing['format_id'], $order->billing, 1, '', '<br>'));
foreach ($billing_address_array as $key=>$value)  {
$pdf->addText($indent,$pos -= IPS_LEADING,IPS_FONT_SIZE,$value);
}


if ($order->delivery != $order->billing)	 {
// right rounded rectangle around ship to info
 $pdf->setStrokeColor(0,0,0);
 $pdf->setLineStyle(1);
 $pdf->roundedRectangle(228,450,190,100,10,$f=0);

// ship to info in middle column
 $pdf->addText(MIDDLE_COLUMN_START,$y,SUB_HEADING_FONT_SIZE,"<b>" . ENTRY_SHIP_TO . "</b>");

 $pos = $y;
 $indent = MIDDLE_COLUMN_START + TEXT_BLOCK_INDENT;

//  $address_array=explode('<br>',tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br>'));
 foreach ($delivery_address_array as $key=>$value)  {
  $pdf->addText($indent,$pos -= IPS_LEADING,IPS_FONT_SIZE,$value);
 }
}

// logo image  set to right below store name/address.. change first number to move sideways
$pdf->addJpegFromFile(BATCH_PRINT_INC . 'templates/' . 'integrated_logo.jpg',450,400,55,40);

 $pos = $y;
 $address_array=explode('<br>', str_replace("\r\n", "<br>", STORE_NAME_ADDRESS));
foreach ($address_array as $key=>$value)  {
// echo $value.'<br>';
$pdf->addText(RIGHT_COLUMN_START,$pos -= IPS_LEADING,IPS_FONT_SIZE,$value);
}
 $pdf->addText(RIGHT_COLUMN_START,$pos -= IPS_LEADING,IPS_FONT_SIZE,WEBSITE);

// phone and email statments .. added blank lines if turned off so as to maintain layout
//if ($HTTP_POST_VARS['show_phone'] || $HTTP_POST_VARS['show_email'] ) {

$pos -= SECTION_DIVIDER;
$pdf->ezSetY($pos - 20 );

//if ($HTTP_POST_VARS['show_phone']) {
$pos = $pdf->ezText("<b>" . ENTRY_PHONE . "</b> " . $order->customer['telephone'],IPS_FONT_SIZE);

//}  if ($HTTP_POST_VARS['show_email']) {
$pos = $pdf->ezText("<b>" . ENTRY_EMAIL . "</b> " .$order->customer['email_address'],IPS_FONT_SIZE);
//}
//} else {

//$pos -= SECTION_DIVIDER;
//$pdf->ezSetY($pos - 40 );

//$pos = $pdf->ezText("");



//}
// divider between email and payment method 
$pos -= SECTION_DIVIDER;
$pdf->ezSetY($pos);

// payment method  
//if ($HTTP_POST_VARS['show_pay_method']) {
$pos = $pdf->ezText("<b>" . ENTRY_PAYMENT_METHOD . "</b> " . str_replace($vilains , $cools ,$order->info['payment_method']),IPS_FONT_SIZE);

//	if ($order->info['payment_method'] == PAYMENT_TYPE) {
//$pos = $pdf->ezText("<b>" . ENTRY_PAYMENT_TYPE . "</b> " . $order->info['cc_type'],IPS_FONT_SIZE);
//$pos = $pdf->ezText("<b>" . ENTRY_CC_OWNER . "</b> " . $order->info['cc_owner'],IPS_FONT_SIZE);
//		if ($HTTP_POST_VARS['show_cc']) {
//		$pos = $pdf->ezText("<b>" . ENTRY_CC_NUMBER . "</b> " . $order->info['cc_number'],IPS_FONT_SIZE);
//		}

//		$pos = $pdf->ezText("<b>" . ENTRY_CC_EXP . "</b> " . $order->info['cc_expires'],IPS_FONT_SIZE);
//	}

//}
$pos -= SECTION_DIVIDER;

// products , model etc table layout 
change_color(TABLE_HEADER_BKGD_COLOR);
$pdf->filledRectangle(LEFT_MARGIN,$pos-PRODUCT_TABLE_ROW_HEIGHT,PRODUCT_TABLE_HEADER_WIDTH,PRODUCT_TABLE_ROW_HEIGHT);

$x = LEFT_MARGIN + PRODUCT_TABLE_LEFT_MARGIN;
$pos = ($pos-PRODUCT_TABLE_ROW_HEIGHT) + PRODUCT_TABLE_BOTTOM_MARGIN;

change_color(GENERAL_FONT_COLOR);

$pdf->addText($x,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_PRODUCTS);
$pdf->addText($x += PRODUCTS_COLUMN_SIZE,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_PRODUCTS_MODEL);
if ( $billing_address_array[0] == $delivery_address_array[0]) {
 $pdf->addText($x += MODEL_COLUMN_SIZE,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_TAX);
 $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_PRICE_EXCLUDING_TAX);
 $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_PRICE_INCLUDING_TAX);
 $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_TOTAL_EXCLUDING_TAX);
 $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_TOTAL_INCLUDING_TAX);
 }

$pos -= PRODUCT_TABLE_BOTTOM_MARGIN;

// Sort through the products

for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {

$prod_str = $order->products[$i]['qty'] . " x " . $order->products[$i]['name'];

change_color(PRODUCT_LISTING_BKGD_COLOR);
$pdf->filledRectangle(LEFT_MARGIN,$pos-PRODUCT_TABLE_ROW_HEIGHT,PRODUCT_TABLE_HEADER_WIDTH,PRODUCT_TABLE_ROW_HEIGHT);

$x = LEFT_MARGIN + PRODUCT_TABLE_LEFT_MARGIN;
$pos = ($pos-PRODUCT_TABLE_ROW_HEIGHT) + PRODUCT_TABLE_BOTTOM_MARGIN;
//page feed
if ($pos <= 30) {
$pdf->ezNewPage();
$pos =780;
}
// end page feed
change_color(GENERAL_FONT_COLOR);

$pdf->rectangle(15,$pos-2,8,8);
$truncated_str = $pdf->addTextWrap($x,$pos,PRODUCTS_COLUMN_SIZE,TABLE_HEADER_FONT_SIZE,$prod_str);

$pdf->addText($x += PRODUCTS_COLUMN_SIZE,$pos,TABLE_HEADER_FONT_SIZE,$order->products[$i]['model']);
if ( $billing_address_array[0] == $delivery_address_array[0]) {
 $pdf->addText($x += MODEL_COLUMN_SIZE,$pos,TABLE_HEADER_FONT_SIZE,$order->products[$i]['tax']);
 $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,$currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']));
 $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,$currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']));
 $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,$currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']));
 $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,$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']));
 }
$pos -= PRODUCT_TABLE_BOTTOM_MARGIN;
if ($truncated_str) { 

change_color(PRODUCT_LISTING_BKGD_COLOR);
$pdf->filledRectangle(LEFT_MARGIN,$pos-PRODUCT_TABLE_ROW_HEIGHT,PRODUCT_TABLE_HEADER_WIDTH,PRODUCT_TABLE_ROW_HEIGHT);
$pos = ($pos-PRODUCT_TABLE_ROW_HEIGHT) + PRODUCT_TABLE_BOTTOM_MARGIN;
change_color(GENERAL_FONT_COLOR);
$reset_x = LEFT_MARGIN + PRODUCT_TABLE_LEFT_MARGIN;
$pdf->addText($reset_x,$pos,TABLE_HEADER_FONT_SIZE,$truncated_str);
$pos -= PRODUCT_TABLE_BOTTOM_MARGIN;

}

if ( ($k = sizeof($order->products[$i]['attributes'])) > 0) {
	for ($j = 0; $j < $k; $j++) {
	$attrib_string = '<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];
	if ($order->products[$i]['attributes'][$j]['price'] != '0') { 
	$attrib_string .= ' (' . $order->products[$i]['attributes'][$j]['prefix'] . 
	$currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')'; 

	}

	$attrib_string .= '</i>';
	change_color(PRODUCT_LISTING_BKGD_COLOR);
	$pdf->filledRectangle(LEFT_MARGIN,$pos-PRODUCT_TABLE_ROW_HEIGHT,PRODUCT_TABLE_HEADER_WIDTH,PRODUCT_TABLE_ROW_HEIGHT);
	$pos = ($pos-PRODUCT_TABLE_ROW_HEIGHT) + PRODUCT_TABLE_BOTTOM_MARGIN;
	change_color(GENERAL_FONT_COLOR);
	$reset_x = LEFT_MARGIN + PRODUCT_TABLE_LEFT_MARGIN;
	if (PRODUCT_ATTRIBUTES_TEXT_WRAP) {
	$wrapped_str = $pdf->addTextWrap($reset_x,$pos,PRODUCTS_COLUMN_SIZE,PRODUCT_ATTRIBUTES_FONT_SIZE,$attrib_string);
	} else { 
	$pdf->addText($reset_x,$pos,PRODUCT_ATTRIBUTES_FONT_SIZE,$attrib_string);
	}
	$pos -= PRODUCT_TABLE_BOTTOM_MARGIN;

				if ($wrapped_str) { 
				change_color(PRODUCT_LISTING_BKGD_COLOR);
				$pdf->filledRectangle(LEFT_MARGIN,$pos-PRODUCT_TABLE_ROW_HEIGHT,PRODUCT_TABLE_HEADER_WIDTH,PRODUCT_TABLE_ROW_HEIGHT);
				$pos = ($pos-PRODUCT_TABLE_ROW_HEIGHT) + PRODUCT_TABLE_BOTTOM_MARGIN;
				change_color(GENERAL_FONT_COLOR);
				$pdf->addText($reset_x,$pos,PRODUCT_ATTRIBUTES_FONT_SIZE,$wrapped_str);
				$pos -= PRODUCT_TABLE_BOTTOM_MARGIN;
				}
			}
		}
 } //EOFOR
if ( $billing_address_array[0] == $delivery_address_array[0]) {
 $pos -= PRODUCT_TABLE_BOTTOM_MARGIN;

for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {

$pdf->addText (LEFT_MARGIN ,$pos -= PRODUCT_TOTALS_LEADING,PRODUCT_TOTALS_FONT_SIZE,"<b>" . str_replace($vilains , $cools ,$order->totals[$i]['title']) . "</b>");
$pdf->addText($x,$pos,PRODUCT_TOTALS_FONT_SIZE,$order->totals[$i]['text'], $order->info['currency_value']);

	} //EOFOR
 }
$pos -= SECTION_DIVIDER;

//if ($orders['comments']) {
//$pdf->ezSetY($pos);
//$pdf->ezText("<b>Comments:</b>\n" . $orders['comments'],IPS_FONT_SIZE);
//}

$innum = $orders['orders_id'];
$orders_comments_query = tep_db_query("select comments,date_added from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '$innum' order by date_added");
if (tep_db_num_rows($orders_comments_query)) {
while ($orders_comments = tep_db_fetch_array($orders_comments_query)) {
if(tep_not_null($orders_comments['comments'])){
		$pdf->ezSetY($pos);
		$pdf->ezText(date(TEXT_ORDER_FORMAT, strtotime($orders_comments['date_added'])) ,6);
		$y = $pdf->ezText("<b>Comments:</b> " . $orders_comments['comments'],GENERAL_FONT_SIZE);
		$pos = ($y -5);
	}
}
}

//require(BATCH_PRINT_INC . 'templates/' . 'grid.php');


}
?>

 

I would be very grateful to someone if they would edit the template for me.

 

Thank you

Tommy

Share this post


Link to post
Share on other sites

It isn't too difficult to change... just rather time-consuming. I'm afraid you have to do those things for yourself. The best advice I can offer is that you just play around with it for a while. Check that you are using the right size paper for the dimensions quoted at the top because the labels start way lower than they should. It looks from the template as if you have already made quite a lot of changes from the original.

Share this post


Link to post
Share on other sites

Well radders, that little bit of change was after three days or tinkering with it and just randomly changing numbers.

 

Is anyone not willing to offer me some help with this?

Share this post


Link to post
Share on other sites

ok, I have no idea what happened with my brain that caused it to all of a sudden make sense or at least partial sense to me.

 

I've gotten it all worked out except for one thing.

 

The Subtotal, Shipping, Total lines at the bottom...I want those to be right aligned instead of left aligned so it's easier to line them up closer to the numbers. I can't figure out where to change that. I've found in some of the code of the pdf creation code where it talks about alignment but it's not part of the addtext function. Could someone help me out on this one section?

 

if ( $billing_address_array[0] == $delivery_address_array[0]) {
 $pos -= PRODUCT_TABLE_BOTTOM_MARGIN;

for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {

$pdf->addText (LEFT_MARGIN ,$pos -= PRODUCT_TOTALS_LEADING,PRODUCT_TOTALS_FONT_SIZE,"<b>" . str_replace($vilains , $cools ,$order->totals[$i]['title']) . "</b>");
$pdf->addText($x,$pos,PRODUCT_TOTALS_FONT_SIZE,$order->totals[$i]['text'], $order->info['currency_value']);

	} //EOFOR

 

I want the SubTotal, Shipping, Total lines to be right aligned and for the right alignment to start at approximately at 450 position....that would give a little space between the text and the numbers.

 

Once I get this totally worked out i'll post the template to the contribution for everyone to use.

Share this post


Link to post
Share on other sites

Ok I have with the help from radders. got the template the way I want it.

 

below is the code. I will also be adding it to the contrib.

 

<?php
// set paper type and size
if ($pageloop == "0") {
$pdf = new Cezpdf(Letter,portrait);
} else {

define('LEFT_MARGIN','30');
// The small indents in the Sold to: Ship to: Text blocks
define('TEXT_BLOCK_SMALL_INDENT', '5');
define('TEXT_BLOCK_INDENT', '25');

define('SHIP_TO_COLUMN_START','330');
define('MIDDLE_COLUMN_START','250');
define('RIGHT_COLUMN_START','450');
// This changes the 'Total', 'Sub-Total', 'Tax', and 'Shipping Method' text block
// position, for example if you choose to make the text a bigger font size you need to 
// tweak this value in order to prevent the text from clashing together
define('PRODUCT_TOTAL_TITLE_COLUMN_START','400');
define('RIGHT_MARGIN','30');
define('LINE_LENGTH', '552');
// If you have attributes for certain products, you can have the text wrap
// or just be written completely on one line, with the text wrap disabled
// it makes the tables smaller appear much better, of course that is only my opinion
// so I made this variable if anyone would like it to wrap.
define('PRODUCT_ATTRIBUTES_TEXT_WRAP', true);
// This sets the space size between sections
define('SECTION_DIVIDER', '15');
// Product table Settings
define('TABLE_HEADER_FONT_SIZE', '10');
define('TABLE_HEADER_BKGD_COLOR', DARK_GREY);
define('PRODUCT_TABLE_HEADER_WIDTH', '530');
// This is more like cell padding, it moves the text the number
// of points specified to make the rectangle appear padded
define('PRODUCT_TABLE_BOTTOM_MARGIN', '2');
// Tiny indent right before the product name, again more like
// the cell padding effect
define('PRODUCT_TABLE_LEFT_MARGIN', '2');
// Height of the product listing rectangles
define('PRODUCT_TABLE_ROW_HEIGHT', '11');
// The column sizes are where the product listing columns start on the
// PDF page, if you make the TABLE HEADER FONT SIZE any larger you will
// need to tweak these values to prevent text from clashing together
define('PRODUCTS_COLUMN_SIZE', '215');
define('PRODUCT_LISTING_BKGD_COLOR',GREY);
define('MODEL_COLUMN_SIZE', '62');
define('PRICING_COLUMN_SIZES', '52');

define('SMALL_LEADING', '6');
define('IPS_LEADING', '9');
define('LABEL_LEADING', '12');
define('IPS_FONT_SIZE', '10');
define('LABEL_FONT_SIZE', '12');
define('SENDER_TICKET_SIZE', '8');
define('SENDER_FONT_SIZE', '6');
define('SENDER_SMALL_FONT_SIZE', '7');
define('TICKET_FONT_SIZE', '7');
// This should go in the language file
$vilains = array("à", "á",  "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "÷", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ", "ß","'", " ", "à", "á", "ã","ä", "&Arond;", "è", "æ", "ê", "ë", "ì", "í", "Í", "î", "ï", "ò", "ó", "ô", "õ", "ö", "ø", "ù", "ú", "û", "ü", "ñ", "ç", "ý", "<",">", "&");
$cools = array('à','á','â','ã','ä','å','æ','ç','è','é','ê','ë','ì','í','î','ï','ð','ñ','ò','ó','ô','õ','ö','÷','ø','ù','ú','û','ü','ý','þ','ÿ','ß','\'', ' ','à','á','ã','ä','å','è','æ','ê','ë','ì','í','î','Î','ï','ò','ó','ô','õ','ö','ø','ù','ú','û','ü','ñ','ç','ý','<','>','&');

$currencies = new currencies();

$pdf->selectFont(BATCH_PDF_DIR . 'Helvetica.afm');
$pdf->setFontFamily(BATCH_PDF_DIR . 'Helvetica.afm');
// set up delivery address array
$address_array=explode('<br>',tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br>'));

if (SHIP_FROM_COUNTRY == $address_array[count($address_array)-1]) {
$address_array[count($address_array)-1] = '';
}
$delivery_address_array = array();
$i = 0;
foreach ($address_array as $key => $value) {
 if ((!is_null($value))&& ($value !== "")) {
$delivery_address_array[$i] = $value;
$i++;
 }
}

// set up billing address array
$address_array=explode('<br>',tep_address_format($order->billing['format_id'], $order->billing, 1, '', '<br>'));
$lines = count($address_array)-1;
if (SHIP_FROM_COUNTRY == $address_array[$lines]) {
$address_array[$lines] = '';
}
$billing_address_array = array();
$i = 0;
foreach ($address_array as $key => $value) {
 if ((!is_null($value))&& ($value !== "")) {
$billing_address_array[$i] = $value;
$i++;
 }
}

$address_array=explode('<br>', str_replace("\r\n", "<br>", STORE_NAME_ADDRESS));
$i = 0;
//The first $key number is the number of lines in your store name and address excluding the telephone number at the bottom.
//The second $key number is the number of lines in your store name and address excluding telephone number and country.
foreach ($address_array as $key=>$value)  {
if (((SHIP_FROM_COUNTRY != $order->delivery['country']) && ($key < 5)) || ($key < 4))
{
$store_address_array[$i] = $value;
  $i++;
}
}
$y=720;
$pos = $y;



foreach ($delivery_address_array as $key=>$value)  {
$pdf->addText(LEFT_MARGIN,$pos -= SMALL_LEADING,SENDER_SMALL_FONT_SIZE,$value);
}

$pos=$y;

//  $address_array=explode('<br>', str_replace("\r\n", "<br>", STORE_NAME_ADDRESS));
foreach ($store_address_array as $key=>$value)  {
// echo $value.'<br>';
$pdf->addText(SHIP_TO_COLUMN_START,$pos -= SMALL_LEADING,SENDER_SMALL_FONT_SIZE,$value);
}
  $y-=55;
// company name and details pulled from the my store address and phone number
// in admin configuration mystore 
$pdf->setStrokeColor(0,0,0);
$pdf->setLineStyle(1);
$pdf->roundedRectangle(28,570,230,120,10,$f=0);

// order number
//$y = $pdf->ezText("" . TEXT_ORDER_NUMBER . " " . $orders['orders_id'] ."\n\n",SENDER_FONT_SIZE);
$indent =  LEFT_MARGIN +  TEXT_BLOCK_SMALL_INDENT;
$pdf->addText($indent,$y,SUB_HEADING_FONT_SIZE,"<b>" . TEXT_TO . "</b>");
//$y = $pdf->ezText(STORE_NAME_ADDRESS,GENERAL_FONT_SIZE);
$pos = $y;
$indent =  LEFT_MARGIN +  TEXT_BLOCK_INDENT;

foreach ($store_address_array as $key=>$value)  {
$pdf->addText($indent,$pos -= LABEL_LEADING,LABEL_FONT_SIZE,"<b>".$value."</b>");
}


// logo image  set to right of the above .. change first number to move sideways	
// $pdf->addJpegFromFile(BATCH_PRINT_INC . 'templates/' . 'invoicelogo.jpg',365,730,85,85);


$pdf->setStrokeColor(0,0,0);
$pdf->setLineStyle(1);
$pdf->roundedRectangle(330,570,260,120,10,$f=0);


// ship to info in right column
$indent = SHIP_TO_COLUMN_START + TEXT_BLOCK_SMALL_INDENT;
$pdf->addText($indent,$y,SUB_HEADING_FONT_SIZE,"<b>" . TEXT_TO . "</b>");

$pos = $y;
$indent = SHIP_TO_COLUMN_START + TEXT_BLOCK_INDENT;


foreach ($delivery_address_array as $key=>$value)  {
$pdf->addText($indent,$pos -= LABEL_LEADING,LABEL_FONT_SIZE,"<b>".$value."</b>");
}
$y -=105;
// order number
$pdf->addText(LEFT_MARGIN + 55,$y,TICKET_FONT_SIZE,"" . TEXT_RETURNS_LABEL . " " . $orders['orders_prefix'] . $orders['orders_id'] ."");

$pdf->addText(SHIP_TO_COLUMN_START + 70,$y,TICKET_FONT_SIZE,"" . TEXT_SHIPPING_LABEL . " " . $orders['orders_prefix'] . $orders['orders_id'] ."");

// line between header order number and order date
$y -=30;
  $pdf->addText(LEFT_MARGIN,$y,TICKET_FONT_SIZE, TEXT_RETURNS);
 $y -=3;
$pdf->setLineStyle(1);
$pdf->line(LEFT_MARGIN,$y,LINE_LENGTH,$y);
$pdf->ezSetY($y);
$dup_y = $y;

// order number
$y = $pdf->ezText("<b>" . TEXT_ORDER_NUMBER . " </b>" . $orders['orders_prefix'] . $orders['orders_id'] ."\n\n",SUB_HEADING_FONT_SIZE);

// order date
if ($HTTP_POST_VARS['show_order_date']) {
$pdf->ezSetY($dup_y);
$pdf->ezText("<b>" . TEXT_ORDER_DATE . " </b>" . date(TEXT_ORDER_FORMAT, strtotime($order->info['date_purchased'])) ."\n\n",SUB_HEADING_FONT_SIZE,array('justification'=>'right'));
}

$y -= 10;


//left rounded rectangle around sold to info
$pdf->setStrokeColor(0,0,0);
$pdf->setLineStyle(1);
$pdf->roundedRectangle(28,400,190,100,10,$f=0);


// sold to info in left rectangle	
$pdf->addText(LEFT_MARGIN,$y,SUB_HEADING_FONT_SIZE,"<b>" . ENTRY_SOLD_TO . "</b>");

$pos = $y;
$indent = LEFT_MARGIN + TEXT_BLOCK_INDENT;

//  $address_array=explode('<br>',tep_address_format($order->billing['format_id'], $order->billing, 1, '', '<br>'));
foreach ($billing_address_array as $key=>$value)  {
$pdf->addText($indent,$pos -= IPS_LEADING,IPS_FONT_SIZE,$value);
}


if ($order->delivery != $order->billing)	 {
// right rounded rectangle around ship to info
 $pdf->setStrokeColor(0,0,0);
 $pdf->setLineStyle(1);
 $pdf->roundedRectangle(228,400,190,100,10,$f=0);

// ship to info in middle column
 $pdf->addText(MIDDLE_COLUMN_START,$y,SUB_HEADING_FONT_SIZE,"<b>" . ENTRY_SHIP_TO . "</b>");

 $pos = $y;
 $indent = MIDDLE_COLUMN_START + TEXT_BLOCK_INDENT;

//  $address_array=explode('<br>',tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br>'));
 foreach ($delivery_address_array as $key=>$value)  {
  $pdf->addText($indent,$pos -= IPS_LEADING,IPS_FONT_SIZE,$value);
 }
}

// logo image  set to right below store name/address.. change first number to move sideways
$pdf->addJpegFromFile(BATCH_PRINT_INC . 'templates/' . 'integrated_logo.jpg',450,400,55,40);

 $pos = $y;
 $address_array=explode('<br>', str_replace("\r\n", "<br>", STORE_NAME_ADDRESS));
foreach ($address_array as $key=>$value)  {
// echo $value.'<br>';
$pdf->addText(RIGHT_COLUMN_START,$pos -= IPS_LEADING,IPS_FONT_SIZE,$value);
}
 $pdf->addText(RIGHT_COLUMN_START,$pos -= IPS_LEADING,IPS_FONT_SIZE,WEBSITE);

// phone and email statments .. added blank lines if turned off so as to maintain layout
//if ($HTTP_POST_VARS['show_phone'] || $HTTP_POST_VARS['show_email'] ) {

$pos -= SECTION_DIVIDER;
$pdf->ezSetY($pos - 20 );

//if ($HTTP_POST_VARS['show_phone']) {
$pos = $pdf->ezText("<b>" . ENTRY_PHONE . "</b> " . $order->customer['telephone'],IPS_FONT_SIZE);

//}  if ($HTTP_POST_VARS['show_email']) {
$pos = $pdf->ezText("<b>" . ENTRY_EMAIL . "</b> " .$order->customer['email_address'],IPS_FONT_SIZE);
//}
//} else {

//$pos -= SECTION_DIVIDER;
//$pdf->ezSetY($pos - 40 );

//$pos = $pdf->ezText("");



//}
// divider between email and payment method 
$pos -= SECTION_DIVIDER;
$pdf->ezSetY($pos);

// payment method  
//if ($HTTP_POST_VARS['show_pay_method']) {
$pos = $pdf->ezText("<b>" . ENTRY_PAYMENT_METHOD . "</b> " . str_replace($vilains , $cools ,$order->info['payment_method']),IPS_FONT_SIZE);

//	if ($order->info['payment_method'] == PAYMENT_TYPE) {
//$pos = $pdf->ezText("<b>" . ENTRY_PAYMENT_TYPE . "</b> " . $order->info['cc_type'],IPS_FONT_SIZE);
//$pos = $pdf->ezText("<b>" . ENTRY_CC_OWNER . "</b> " . $order->info['cc_owner'],IPS_FONT_SIZE);
//		if ($HTTP_POST_VARS['show_cc']) {
//		$pos = $pdf->ezText("<b>" . ENTRY_CC_NUMBER . "</b> " . $order->info['cc_number'],IPS_FONT_SIZE);
//		}

//		$pos = $pdf->ezText("<b>" . ENTRY_CC_EXP . "</b> " . $order->info['cc_expires'],IPS_FONT_SIZE);
//	}

//}
$pos -= SECTION_DIVIDER;

// products , model etc table layout 
change_color(TABLE_HEADER_BKGD_COLOR);
$pdf->filledRectangle(LEFT_MARGIN,$pos-PRODUCT_TABLE_ROW_HEIGHT,PRODUCT_TABLE_HEADER_WIDTH,PRODUCT_TABLE_ROW_HEIGHT);

$x = LEFT_MARGIN + PRODUCT_TABLE_LEFT_MARGIN;
$pos = ($pos-PRODUCT_TABLE_ROW_HEIGHT) + PRODUCT_TABLE_BOTTOM_MARGIN;

change_color(GENERAL_FONT_COLOR);

$pdf->addText($x,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_PRODUCTS_MODEL);
$pdf->addText($x += MODEL_COLUMN_SIZE,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_PRODUCTS);
$pdf->addText($x += MODEL_COLUMN_SIZE + PRODUCTS_COLUMN_SIZE, $pos, TABLE_HEADER_FONT_SIZE, TABLE_HEADING_QTY);
if ( $billing_address_array[0] == $delivery_address_array[0]) {
 //$pdf->addText($x += MODEL_COLUMN_SIZE,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_TAX);
 $pdf->addText($x += MODEL_COLUMN_SIZE,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_PRICE_EXCLUDING_TAX);
 //$pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_PRICE_INCLUDING_TAX);
 $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_TOTAL_EXCLUDING_TAX);
 //$pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,TABLE_HEADING_TOTAL_INCLUDING_TAX);
 }

$pos -= PRODUCT_TABLE_BOTTOM_MARGIN;

// Sort through the products

for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {

//$prod_str = $order->products[$i]['qty'] . " x " . $order->products[$i]['name'];
$prod_str = $order->products[$i]['name'];


change_color(PRODUCT_LISTING_BKGD_COLOR);
$pdf->filledRectangle(LEFT_MARGIN,$pos-PRODUCT_TABLE_ROW_HEIGHT,PRODUCT_TABLE_HEADER_WIDTH,PRODUCT_TABLE_ROW_HEIGHT);

$x = LEFT_MARGIN + PRODUCT_TABLE_LEFT_MARGIN;
$pos = ($pos-PRODUCT_TABLE_ROW_HEIGHT) + PRODUCT_TABLE_BOTTOM_MARGIN;
//page feed
if ($pos <= 30) {
$pdf->ezNewPage();
$pos =780;
}
// end page feed
change_color(GENERAL_FONT_COLOR);

$pdf->rectangle(15,$pos-2,8,8);
// $pdf->addText($x += PRODUCTS_COLUMN_SIZE,$pos,TABLE_HEADER_FONT_SIZE,$order->products[$i]['model']);
$pdf->addText($x, $pos, TABLE_HEADER_FONT_SIZE, $order->products[$i]['model']);
$truncated_str = $pdf->addTextWrap($x += MODEL_COLUMN_SIZE,$pos,PRODUCTS_COLUMN_SIZE,TABLE_HEADER_FONT_SIZE,$prod_str);
$pdf->addText($x += MODEL_COLUMN_SIZE + PRODUCTS_COLUMN_SIZE,$pos,TABLE_HEADER_FONT_SIZE,$order->products[$i]['qty']);


if ( $billing_address_array[0] == $delivery_address_array[0]) {
 //$pdf->addText($x += MODEL_COLUMN_SIZE,$pos,TABLE_HEADER_FONT_SIZE,$order->products[$i]['tax']);
 $pdf->addText($x += MODEL_COLUMN_SIZE,$pos,TABLE_HEADER_FONT_SIZE,$currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']));
 //$pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,$currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']));
 $pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,$currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']));
 //$pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,$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']));
 }
$pos -= PRODUCT_TABLE_BOTTOM_MARGIN;
if ($truncated_str) { 

change_color(PRODUCT_LISTING_BKGD_COLOR);
$pdf->filledRectangle(LEFT_MARGIN,$pos-PRODUCT_TABLE_ROW_HEIGHT,PRODUCT_TABLE_HEADER_WIDTH,PRODUCT_TABLE_ROW_HEIGHT);
$pos = ($pos-PRODUCT_TABLE_ROW_HEIGHT) + PRODUCT_TABLE_BOTTOM_MARGIN;
change_color(GENERAL_FONT_COLOR);
$reset_x = LEFT_MARGIN + PRODUCT_TABLE_LEFT_MARGIN;
$pdf->addText($reset_x,$pos,TABLE_HEADER_FONT_SIZE,$truncated_str);
$pos -= PRODUCT_TABLE_BOTTOM_MARGIN;

}

if ( ($k = sizeof($order->products[$i]['attributes'])) > 0) {
	for ($j = 0; $j < $k; $j++) {
	$attrib_string = '<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];
	if ($order->products[$i]['attributes'][$j]['price'] != '0') { 
	$attrib_string .= ' (' . $order->products[$i]['attributes'][$j]['prefix'] . 
	$currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')'; 

	}

	$attrib_string .= '</i>';
	change_color(PRODUCT_LISTING_BKGD_COLOR);
	$pdf->filledRectangle(LEFT_MARGIN,$pos-PRODUCT_TABLE_ROW_HEIGHT,PRODUCT_TABLE_HEADER_WIDTH,PRODUCT_TABLE_ROW_HEIGHT);
	$pos = ($pos-PRODUCT_TABLE_ROW_HEIGHT) + PRODUCT_TABLE_BOTTOM_MARGIN;
	change_color(GENERAL_FONT_COLOR);
	$reset_x = LEFT_MARGIN + PRODUCT_TABLE_LEFT_MARGIN;
	if (PRODUCT_ATTRIBUTES_TEXT_WRAP) {
	$wrapped_str = $pdf->addTextWrap($reset_x += MODEL_COLUMN_SIZE,$pos,PRODUCTS_COLUMN_SIZE,PRODUCT_ATTRIBUTES_FONT_SIZE,$attrib_string);
	} else { 
	$pdf->addText($reset_x += MODEL_COLUMN_SIZE,$pos,PRODUCT_ATTRIBUTES_FONT_SIZE,$attrib_string);
	}
	$pos -= PRODUCT_TABLE_BOTTOM_MARGIN;

				if ($wrapped_str) { 
				change_color(PRODUCT_LISTING_BKGD_COLOR);
				$pdf->filledRectangle(LEFT_MARGIN,$pos-PRODUCT_TABLE_ROW_HEIGHT,PRODUCT_TABLE_HEADER_WIDTH,PRODUCT_TABLE_ROW_HEIGHT);
				$pos = ($pos-PRODUCT_TABLE_ROW_HEIGHT) + PRODUCT_TABLE_BOTTOM_MARGIN;
				change_color(GENERAL_FONT_COLOR);
				$pdf->addText($reset_x,$pos,PRODUCT_ATTRIBUTES_FONT_SIZE,$wrapped_str);
				$pos -= PRODUCT_TABLE_BOTTOM_MARGIN;
				}
			}
		}
 } //EOFOR
if ( $billing_address_array[0] == $delivery_address_array[0]) {
 $pos -= PRODUCT_TABLE_BOTTOM_MARGIN;

for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {

//$pdf->addText (LEFT_MARGIN ,$pos -= PRODUCT_TOTALS_LEADING,PRODUCT_TOTALS_FONT_SIZE,"<b>" . str_replace($vilains , $cools ,$order->totals[$i]['title']) . "</b>");

//$pdf->addText (355 ,$pos -= PRODUCT_TOTALS_LEADING,PRODUCT_TOTALS_FONT_SIZE,"<b>" . str_replace($vilains , $cools ,$order->totals[$i]['title']) . "</b>");   


//addTextWrap($x,$y,$width,$size,$text,$justification='left',$angle=0,$test=0)

$pdf->addTextWrap(250, $pos -= PRODUCT_TOTALS_LEADING, PRODUCTS_COLUMN_SIZE, PRODUCT_TOTALS_FONT_SIZE,"<b>" . str_replace($vilains , $cools ,$order->totals[$i]['title']) . "</b>",$justification='right');

$pdf->addText($x,$pos,PRODUCT_TOTALS_FONT_SIZE,$order->totals[$i]['text'], $order->info['currency_value']);

	} //EOFOR
 }
$pos -= SECTION_DIVIDER;

//if ($orders['comments']) {
//$pdf->ezSetY($pos);
//$pdf->ezText("<b>Comments:</b>\n" . $orders['comments'],IPS_FONT_SIZE);
//}

$innum = $orders['orders_id'];
$orders_comments_query = tep_db_query("select comments,date_added from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '$innum' order by date_added");
if (tep_db_num_rows($orders_comments_query)) {
while ($orders_comments = tep_db_fetch_array($orders_comments_query)) {
if(tep_not_null($orders_comments['comments'])){
		$pdf->ezSetY($pos);
		$pdf->ezText(date(TEXT_ORDER_FORMAT, strtotime($orders_comments['date_added'])) ,6);
		$y = $pdf->ezText("<b>Comments:</b> " . $orders_comments['comments'],GENERAL_FONT_SIZE);
		$pos = ($y -5);
	}
}
}

//require(BATCH_PRINT_INC . 'templates/' . 'grid.php');


}
?>

Share this post


Link to post
Share on other sites

Hello.

 

Great Contribution!

 

When I try to let the contribution notify the customers when I do batch orders no e-mail is send. Do you know what the problem is?

 

Best regards

Share this post


Link to post
Share on other sites

i like this contribution a lot!!!

 

currently I'm trying to add a logo to the generated pdf's.

 

This is kind of how I'm trying to get it to work: (in admin/batch_print.php after $y = $pdf->ezText(STORE_NAME_ADDRESS,COMPANY_HEADER_FONT_SIZE);

$y -= 10; )

 

$pdf->ezImage('images/mylogo.gif','0','full','','right','');

 

It actually doesn't do much but make a big white space 2 pages long. :blush:

 

Can anyone point in the right direction?

Share this post


Link to post
Share on other sites

I'm still getting problems with the contribution finding any orders to export within the date ranges I provide. I have altered the batch_print file as instructed in previous posts to no avail. I am running SQL 5.0.27.

 

I would be grateful if anyone could suggest a solution to this problem.

 

Thanks

 

 

EDIT: It's also occurred to me that I am using the English version of the date format and not the US version. For example my dates are structured as 11/11/2007 and not 2007/11/11. Will this produce this problem?

Edited by amigaman

Share this post


Link to post
Share on other sites
I'm still getting problems with the contribution finding any orders to export within the date ranges I provide. I have altered the batch_print file as instructed in previous posts to no avail. I am running SQL 5.0.27.

 

I would be grateful if anyone could suggest a solution to this problem.

 

Thanks

EDIT: It's also occurred to me that I am using the English version of the date format and not the US version. For example my dates are structured as 11/11/2007 and not 2007/11/11. Will this produce this problem?

 

 

Even if I just select the order number it produces the same result. Obviously some problem connecting to the database. Any idea from anyone or is this contribution dead?

Share this post


Link to post
Share on other sites

Hi everybody.

Very nice contrib I use everyday!

Is there a way to generate a pdf invoice without using the batch print center ? I would like to add one pdf to the email invoice.

 

the idea would be to generate individual pdf with order number as name in a file on the admin and then we could retrieve it to add to the email.

 

I know PDF invoice contribution made it but I dont want to multiply the contributions as this one already generate pdf invoices...

Thanks

Seb


Osc 2.2 MS2

Share this post


Link to post
Share on other sites
Even if I just select the order number it produces the same result. Obviously some problem connecting to the database. Any idea from anyone or is this contribution dead?

 

This code change addresses any issues people might be getting where the correct number of orders is not returned in the PDF file. I think the problem stems from extracting info from the orders_status_history table. Firstly, the original query only extracts orders where the order id is present in both the orders status history AND the orders tables (the h.orders_id = o.orders_id part of the original query below). Therefore if you have never set the status for any orders, these won't appear in your PDF when the query is run. Secondly, if you have never set the status of the order in the orders status history table, the query won't extract any information.

 

I replaced the original queries in the admin/batch_print.php (see below):

 

// if there is a invoice number use first order query otherwise use second date style order query
if ($invoicenumbers != '') {
$orders_query = tep_db_query("select o.orders_id,h.comments,MIN(h.date_added) from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_STATUS_HISTORY . " h where o.orders_id in (" . tep_db_input($invoicenumbers) . ") and h.orders_id = o.orders_id" . $pull_w_status . $get_customer_comments . ' group by o.orders_id');
} else {  
$orders_query = tep_db_query("select o.orders_id,h.comments,MIN(h.date_added) from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_STATUS_HISTORY . " h where o.date_purchased between '" . tep_db_input($startdate) . "' and '" . tep_db_input($enddate) . " 23:59:59' and h.orders_id = o.orders_id" . $pull_w_status . $get_customer_comments . ' group by o.orders_id');
}

 

With:

 

$orders_status_history_query = tep_db_query("select * from " . TABLE_ORDERS_STATUS_HISTORY);
// if there is a invoice number use first order query otherwise use second date style order query
if ($invoicenumbers != '') {
// if there is a invoice number use first order query otherwise use second date style order query
if (tep_db_num_rows($orders_status_history_query) > 0){
$orders_query = tep_db_query("select o.orders_id,h.comments,MIN(h.date_added) from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_STATUS_HISTORY . " h where o.orders_id in (" . tep_db_input(		$invoicenumbers) . ")" . $pull_w_status . $get_customer_comments . ' group by o.orders_id');
} else {
$orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id in (" . tep_db_input(		$invoicenumbers) . ")" . $pull_w_status . $get_customer_comments . ' group by orders_id');
}

} else {  
if (tep_db_num_rows($orders_status_history_query) > 0){
$orders_query = tep_db_query("select o.orders_id,h.comments,MIN(h.date_added) from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_STATUS_HISTORY . " h where o.date_purchased between '" . tep_db_input($startdate) . "' and '" . tep_db_input($enddate) . " 23:59:59'" . $pull_w_status . $get_customer_comments . ' group by o.orders_id');
} else {
$orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where date_purchased between '" . tep_db_input($startdate) . "' and '" . tep_db_input($enddate) . " 23:59:59'" . $pull_w_status . $get_customer_comments . ' group by orders_id');
}
}

 

 

This only includes info from the orders status history table if there is anything in it. Otherwise, it doesn't access the table at all. I've also removed the condition which says that the order id has to be present in both the orders status history table and the orders table (h.orders_id = o.orders_id).

 

The result for me is that all the relevant orders are produced in the PDF file. I am not however a PHP coder, so if there are any ommissions or glaring errors with this code change, please let me know!

Edited by Deju

See osCommerce in action at

Share this post


Link to post
Share on other sites

Hi there,

 

I am looking for someway to prevent problems with timeouts. When I try and print a few days worth of orders the scripts often timesout! There are often allot of orders to process.

 

The main issue is I need to change the status of orders when they go to print. When it times out I have no way of telling which orders have had their status changed without checking each order one by one.

 

Has anyone got an easy to implement solution to this problem? The only way I can think to deal with it is to take the status update code out the main script and place it in a separate file which you run only when the print has been completed successfully.

 

Any help suggestions very welcome.

 

Thanks in advance.

Share this post


Link to post
Share on other sites

Dear all:

 

My server information is below:

Database: MySQL 4.1.22-standard-log

HTTP Server: Apache 3 - nowhere

PHP Version: 5.2.4 (Zend: 2.2.0)

 

I can't run Batch Print Center.

 

Program Message:Invalid date, Please enter a valid date in Year-Month-Day (0000-00-00) format.

Would you please help to advise asap?

 

Best Regards,

Share this post


Link to post
Share on other sites

Hi people. I just got this to work I had to use the 1056 fix but now I'm only getting

 

Program Message:

There were no orders selected for export, try changing your order options.

 

No matter what I do I have orders to print but batch print doesn't seem to see them.

Share this post


Link to post
Share on other sites
Hi people. I just got this to work I had to use the 1056 fix but now I'm only getting

 

Program Message:

There were no orders selected for export, try changing your order options.

 

No matter what I do I have orders to print but batch print doesn't seem to see them.

 

I had the same, i just followed this members post and it worked:

 

This code change addresses any issues people might be getting where the correct number of orders is not returned in the PDF file. I think the problem stems from extracting info from the orders_status_history table. Firstly, the original query only extracts orders where the order id is present in both the orders status history AND the orders tables (the h.orders_id = o.orders_id part of the original query below). Therefore if you have never set the status for any orders, these won't appear in your PDF when the query is run. Secondly, if you have never set the status of the order in the orders status history table, the query won't extract any information.

 

I replaced the original queries in the admin/batch_print.php (see below):

 

// if there is a invoice number use first order query otherwise use second date style order query
if ($invoicenumbers != '') {
$orders_query = tep_db_query("select o.orders_id,h.comments,MIN(h.date_added) from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_STATUS_HISTORY . " h where o.orders_id in (" . tep_db_input($invoicenumbers) . ") and h.orders_id = o.orders_id" . $pull_w_status . $get_customer_comments . ' group by o.orders_id');
} else {  
$orders_query = tep_db_query("select o.orders_id,h.comments,MIN(h.date_added) from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_STATUS_HISTORY . " h where o.date_purchased between '" . tep_db_input($startdate) . "' and '" . tep_db_input($enddate) . " 23:59:59' and h.orders_id = o.orders_id" . $pull_w_status . $get_customer_comments . ' group by o.orders_id');
}

 

With:

 

$orders_status_history_query = tep_db_query("select * from " . TABLE_ORDERS_STATUS_HISTORY);
// if there is a invoice number use first order query otherwise use second date style order query
if ($invoicenumbers != '') {
// if there is a invoice number use first order query otherwise use second date style order query
if (tep_db_num_rows($orders_status_history_query) > 0){
$orders_query = tep_db_query("select o.orders_id,h.comments,MIN(h.date_added) from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_STATUS_HISTORY . " h where o.orders_id in (" . tep_db_input(		$invoicenumbers) . ")" . $pull_w_status . $get_customer_comments . ' group by o.orders_id');
} else {
$orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id in (" . tep_db_input(		$invoicenumbers) . ")" . $pull_w_status . $get_customer_comments . ' group by orders_id');
}

} else {  
if (tep_db_num_rows($orders_status_history_query) > 0){
$orders_query = tep_db_query("select o.orders_id,h.comments,MIN(h.date_added) from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_STATUS_HISTORY . " h where o.date_purchased between '" . tep_db_input($startdate) . "' and '" . tep_db_input($enddate) . " 23:59:59'" . $pull_w_status . $get_customer_comments . ' group by o.orders_id');
} else {
$orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where date_purchased between '" . tep_db_input($startdate) . "' and '" . tep_db_input($enddate) . " 23:59:59'" . $pull_w_status . $get_customer_comments . ' group by orders_id');
}
}

 

 

This only includes info from the orders status history table if there is anything in it. Otherwise, it doesn't access the table at all. I've also removed the condition which says that the order id has to be present in both the orders status history table and the orders table (h.orders_id = o.orders_id).

 

The result for me is that all the relevant orders are produced in the PDF file. I am not however a PHP coder, so if there are any ommissions or glaring errors with this code change, please let me know!

Share this post


Link to post
Share on other sites
Dear all:

 

My server information is below:

Database: MySQL 4.1.22-standard-log

HTTP Server: Apache 3 - nowhere

PHP Version: 5.2.4 (Zend: 2.2.0)

 

I can't run Batch Print Center.

 

Program Message:Invalid date, Please enter a valid date in Year-Month-Day (0000-00-00) format.

Would you please help to advise asap?

 

Best Regards,

 

This contrib requires register globals to be "on". Change it and the problem should be fixed. The problem is that with register globals off, the variables are not passed through to the following window correctly, hence the message.

 

Regards

Dan

Share this post


Link to post
Share on other sites

This contrib requires register globals to be "on". Change it and the problem should be fixed. The problem is that with register globals off, the variables are not passed through to the following window correctly, hence the message.

 

Regards

Dan

 

Did someone think of a way to use this with Register Globals OFF ?

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
Sign in to follow this  

×