Jump to content
Sign in to follow this  
defender39

Batch Order Center Update 1.1

Recommended Posts

Yes - see earlier in the thread. Just delete the second function declaration:

 

function verify_date($enddate) {
$error = 0;
list($year,$month,$day) = explode('-', $enddate);

if ((strlen($year) != 4) || !is_numeric($year)) {
$error++;
}
if ((strlen($month) != 2) || !is_numeric($month)) {
$error++;
}
if ((strlen($day) != 2) || !is_numeric($day)) {
$error++;
}

return $error;

}

 

or alternatively simply change the name in the definition to something like verify1_date($enddate) instead of verify_date($enddate)

 

It will then be ignored.

Share this post


Link to post
Share on other sites

One more thing..

 

I'm trying to add the customers_id to the pdf output. I not sure how you're calling that from the DB. any suggestions?

 

Pete


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

Long Island, New York

Share this post


Link to post
Share on other sites

hi, i really like this contribution. can someone give me a hint as to how to add an extra column to the pdf invoice? i have the upc mod, and need that to show on the invoice. thank you.

 

alex

Edited by alexhere

Share this post


Link to post
Share on other sites

sorry, i forgot to add, is there a way to remove the prices in order to turn this into a packing slip pdf? thanks very much.

 

alex

Share this post


Link to post
Share on other sites

Just installed the Batch Order Center Update 1.1 and am getting the following error.

 

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

select o.orders_id,h.comments,MIN(h.date_added) from orders o, orders_status_history h where o.date_purchased between '2004-02-27' and '2004-02-2823:59:59' and h.orders_id = o.orders_id and o.orders_status = 1 and h.orders_status_id = 1 group by o.orders_id

[TEP STOP]

 

 

Anyone have a clue what this means? And how to fix it?

 

Thanks!

 

Bobby


Jared Geesey

Share this post


Link to post
Share on other sites

The most likely explanation is that the table 'orders_status_history in your database is missing the field 'comments'. This is how the table shoiuld look.

# Table structure for table `orders_status_history`

#

 

CREATE TABLE `orders_status_history` (

  `orders_status_history_id` int(11) NOT NULL auto_increment,

  `orders_id` int(11) NOT NULL default '0',

  `orders_status_id` int(5) NOT NULL default '0',

  `date_added` datetime NOT NULL default '0000-00-00 00:00:00',

  `customer_notified` int(1) default '0',

  `comments` text,

  PRIMARY KEY  (`orders_status_history_id`)

) TYPE=MyISAM AUTO_INCREMENT=5 ;

 

You could try adding the missing field using phpmyadmin.

Share this post


Link to post
Share on other sites

Removing prices is easy. Just comment out the following three sections in admin/batch_print.php:

$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);

$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']));

	for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {	
$pdf->addText(LEFT_MARGIN + 200,$pos -= PRODUCT_TOTALS_LEADING,PRODUCT_TOTALS_FONT_SIZE,"<b>" . $order->totals[$i]['title'] . "</b>");
$pdf->addText($x,$pos,PRODUCT_TOTALS_FONT_SIZE,$order->totals[$i]['text']);
	 } //EOFOR

 

When comes to adding in new columns, try just amending an existng line. The formatting of the pdf file is something of a nightmare.

Share this post


Link to post
Share on other sites

Radders,

 

That worked great!!! Thank you!

 

Now trying to add the Comments to the PDF form. Is that a quick addition to make? Any tips?

 

Thanks!

 

Bobby

 

PS. This is gong to be SOOOO much better than printing orders one by one by one.


Jared Geesey

Share this post


Link to post
Share on other sites

Also, how do I make the font size smaller for the text on the PDF form? Some of my text is doubled up over the top of other text because my product names are longer.

 

Thanks!

 

Bobby


Jared Geesey

Share this post


Link to post
Share on other sites

For MS2:

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

define('BOX_TOOLS_BATCH_CENTER', 'Batch Order Center');

Don't touch application_top

 

Add this to admin/includes/filenames.php

  define('FILENAME_BATCH_PRINT', 'batch_print.php');

Share this post


Link to post
Share on other sites

Bobby,

The file you need to edit to change the font sizes is:

admin/languages/english/batch_print.php

Look for:

define('GENERAL_FONT_SIZE', '11');

etc.

 

Maybe it is the products attributes causing the problem. Product description nomally would wrap onto the next line. You might like to set the attributes to wrap in the same way as the product description does.

define('PRODUCT_ATTRIBUTES_TEXT_WRAP', false);

is how it is currently set

 

Alex,

To turn it into a packing slip you would also need to increase the column size as well as removing the prices

define('PRODUCTS_COLUMN_SIZE', '172');

is the default setting

Share this post


Link to post
Share on other sites
For MS2:

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

define('BOX_TOOLS_BATCH_CENTER', 'Batch Order Center');

Don't touch application_top

 

Add this to admin/includes/filenames.php

 ?define('FILENAME_BATCH_PRINT', 'batch_print.php');

Thanks for the info, i also added the code below on the tools.php

 

'<a href="' . tep_href_link(FILENAME_BATCH_PRINT) . '" class="menuBoxContentLink">' . BOX_TOOLS_BATCH_CENTER . '</a><br>' .

 

Does anyone happen to know how to fix this error?

 

Fatal error: Cannot redeclare verify_date() (previously declared in /home/*****/public_html/products/admin/batch_print.php:320) in /home/*****/public_html/products/admin/batch_print.php on line 339

 

From lines 339-355 has this info, and i haven't modified batch_print.php in anyway.

 

function verify_date($enddate) {
$error = 0;
list($year,$month,$day) = explode('-', $enddate);

if ((strlen($year) != 4) || !is_numeric($year)) {
$error++;
}
if ((strlen($month) != 2) || !is_numeric($month)) {
$error++;
}
if ((strlen($day) != 2) || !is_numeric($day)) {
$error++;
}

return $error;

}

 

Thanks again!

Share this post


Link to post
Share on other sites

Hi David,

 

Forgive my ignorance. Which file is

define('PRODUCT_ATTRIBUTES_TEXT_WRAP', false);

 

located in?

 

Thanks,

 

Bobby

 

PS. I found some of those font size controls and it looks great now for my set up.


Jared Geesey

Share this post


Link to post
Share on other sites

Hi David,

 

Regarding the Comments field on the PDF, here is what I am getting on the PDF...

 

Comments:

The comments for your order are

Automatic order update notification.

 

 

The above note shows up in every PDF report even when there are comments in the actual order.

How do I tie the comments field that our site currently uses into this comments field in the order_status_history comments field (which is what I believe the PDF is using... is that correct?).

 

The "comments" field I use is currently located in my "orders" table.

 

Thoughts?

 

Thanks!

 

Bobby


Jared Geesey

Share this post


Link to post
Share on other sites
Yes,

Read the previous page of this thread!

Thanks, sorry for asking that question. I must of missed reading that from your previous post.

Share this post


Link to post
Share on other sites

Found the define('PRODUCT_ATTRIBUTES_TEXT_WRAP', false);

in the english/batch_print.php

My brain was tired.

 

Sorry


Jared Geesey

Share this post


Link to post
Share on other sites

Hi David,

 

On about line 42 of admin/batch_print.php we find:

 

 

$pdf->selectFont(BATCH_PDF_DIR . 'Helvetica.afm');
$pdf->setFontFamily(BATCH_PDF_DIR . 'Helvetica.afm');
if ($HTTP_POST_VARS['show_comments']) { $get_customer_comments = ' and h.orders_status_id = ' . DEFAULT_ORDERS_STATUS_ID; }
if ($HTTP_POST_VARS['pull_status']){ $pull_w_status = " and o.orders_status = ". $HTTP_POST_VARS['pull_status']; }

$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');

 

Is this where I would change the IF statement to pull data from the orders table?

 

Not sure how to do this.

 

Bobby


Jared Geesey

Share this post


Link to post
Share on other sites

Hi Bobby,

'Automatic update notification' is the comment that is included in the email sent to the customer (text is defined in the associated language file includes/languiages/english/batch_print.php). This should not be printed on the pdf.

 

The comments included on the pdf come from orders_status_history via the SQL query you mention. If your version of osCommerce is different you may need to change the SQL.

 

What version are you using?

Share this post


Link to post
Share on other sites

Using a November 2002 version.

 

The comments field is in the ORDERS Table. Via phpMyAdmin I can see all of the custumer comments in there.

 

Is it as simple as telling the batch_print.php to get the data from the ORDERS table? Or are there other places that must be changed as well?

 

Thanks,

 

Bobby


Jared Geesey

Share this post


Link to post
Share on other sites

When the check box is checked next to:

 

Show orders without comments?

(Will NOT show order with comments placed by the customer at time of order.)

 

Then this is when the Comments on the PDF read....

 

Comments:

The comments for your order are

Automatic order update notification.

 

 

What code do I put in the string to tell batch_print to get the comments from the ORDERS table?

 

Thanks a ton! When our staff came in this morning they were thrilled about this update! Thank you, Thank you, Thank you!

 

Bobby


Jared Geesey

Share this post


Link to post
Share on other sites

Hi Bobby,

Well done.

I'm afraid I don't know the answer to your last question. Every snapshot is different so until you upgrade to a standard version some things will work as expected and others will not.

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  

×