View Full Version : batch order center doesnt work

10-20-2009, 10:44 AM
i try a simple print of one order and get this:

1054 - Unknown column 'o.orders_prefix' in 'field list'

select o.orders_id,o.orders_prefix,h.comments,MIN(h.date_ added) from orders o, orders_status_history h where o.date_purchased between '2009-10-20' and '2009-10-20 23:59:59' and h.orders_id = o.orders_id group by o.orders_id



10-20-2009, 11:00 AM

I have just checked this and I get the same error message ... I will investigate ... :confused:


10-20-2009, 11:06 AM
You have found a previously unreported bug. It is however a known issue with the Batch Print Center mod. This is the fix:

In /admin/batch_print.php find:

// 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,o.orders_prefix,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,o.orders_prefix,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');

Change to:

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

10-20-2009, 11:19 AM
Just found that myself!

Was about to post - Michael you are too quick ...


10-20-2009, 11:28 AM

still not working, oscmax doesnt seem to find the one order i have even though i enter the order number and the date range:

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


10-20-2009, 11:41 AM
It may not work, the mod is very buggy. Here are the known issues with this mod from the list included in the mod zip file:

Bad coding . .Im no coder but batch print center works
for me and the beta testers so if you can code better
please do so. If the sql queries need updating again
please do so. If my logic is flawed or security low
please fix and let me know.

When printing labels the lowest number label is skipped.
So if you want labels 30 thru 40 choose 29-40 as a work around
till thsi issue is fixed.

If you enter text into some of the fields you may/will get sql errors.

Address layout issues, Depending on the country you are sending to
you may think the address label format is wrong. For me its ok but
don't stress there will be fixs for your country as soon as i know
what exactly your country requires.

When clicking on send after defining your options you get the error:
Error 1054 - Unknown column 'o.orders_prefix' in 'field list'
That means that you are not using database prefix (which is fine..).
To fix it copy the batch_print.php from the "Fix for Error 1054"-Folder to your admin folder.

100's of other errors. Ok I haven't found any major errors but
I have looked at enough contributions to know that there must be an array
of things i would have missed.

10-20-2009, 11:42 AM
You can also try updating the mod to 3.1.1, there are several fixes included in it.

10-20-2009, 11:56 AM
I just tested the fix, and I was able to create my batch process without issues, so most likely you are just doing something incorrectly on the page. Here is the manual:

Batch Print Center Manual

Firstly for the best results with the default templates
go into admin / configuration / mystore / store address and phone
and set it to 5 lines so it looks like

Your Company Name
Your street address
Your Suburb, Your City
Your State, Your Country, zip/postcode
Your Email address

You can ofcourse edit the templates to suit your needs the default ones
are only meant as a sample of what can be done.
Most of the templates need some tweaking for your paper size, and your layout preferences.
hopefully the OSCommerce community will get behind sharing these templates.

So if you create a template why not share it with the OSC community.

Using Batch Print Center

Goto into admin tools or admin customers (depending on your setup) and click on the Batch Print Center link.

The first item to choose is what template you wish to use for your printing.
Some of the default templates are very basic examples (like christmas cards) and some are
closer to what you need everyday like invoice, packing slip and the combined packing and invoice which will
print both types for every order you choose.

The next thing is to decide whether you want to print a range of invoices via invoice number
or a range via the date options. If its just one invoice you want type its number. If you want
all the invoices between the number 25 and 35 you would type 25-35
You can combine your invoice numbers so you could request 23,45,67,90-110,160,183
If its between 2 dates that you wish to select your orders then click on each of the arrows next to From and To
and choose the date range you require.

The next section is only for when you are printing labels .. Its lets you choose what type of label
and also lets you specify how many labels are used already on your sheet of labels so you can start printing
from where you have labels remaining.

Now if you only want to print orders with a certin status setting choose that from the drop down list
and choose also if you wish your orders to be autonatically updated to a new status and whether to email
your customers letting them know of the change in status.

Example usage:
If all NEW orders were set to a status like "pending" you could set batch print center to print all packing slips
in the range 1-100000 with a status of pending and auto change the status on print to "processed"
The next time you went to batch print center and did the above again it would only ofcourse print the latest orders.
If you have a group of filled orders ready to post and they only need a invoice to go with them you would
choose the invoice template and enter the numbers of the orders ready to go like 34,38,43,56,78,44,23
and print them changing there status to "delivered" or similar.

10-20-2009, 12:19 PM
is the fixed version (3.1.1) the one currently included in oscmax 2.03?

the addons listed for oscmax only say: Batch Print Center v3

also, it asks for a date range when i have already entered an order number, is this another bug?


10-20-2009, 01:52 PM
The batch order centre install (as michael says) is majorly buggy! I think osCmax had v3 installed ...

I will look at upgrading to the latest version and if it works - if it does I will put together some upgrade instructions.

I suspect that this is a bit of the osCmax code that not many people use on their live stores ...

Will post back with my findings.


10-21-2009, 05:45 AM
Batch print center is a great mod that I use daily, however, it is not register global compliant so in order to have it work correctly it needs register globals on. Since it's under the protection of the admin section I don't sweat that as much but swiching globals on will make it work correctly.

I suck at explaining things which is one reason I don't post more but I will make this mod register global compliant within 6 months and I'll post it here and on the main board. It's the reason I started working on using E_All errors without suppressing E_Notice which opened up a whole can of worms for me.

10-21-2009, 07:30 AM
does Batch print 3.1.1 work though?
will 3.1.1 work on oscmax?

10-21-2009, 07:57 AM
With register globals on and the fixes in place it will work perfectly. I use it every day. I don't think I've fixed anything beyond what's listed but if you are still having problems I'll help you.

10-21-2009, 08:09 AM
it looks like batch print center is up to version 3.12, can i install that on oscmax?

10-21-2009, 08:48 AM
The short answer is yes. The better answer is with any contribution you should understand what has been changed and whether or not it will even benefit you. Some changes actually move contributions backwards or only benefit a specific few. I don't use it to print labels so I don't care what they change there and I only use English so my scope is somewhat narrow. For me, it's important to be able to specify invoice numbers to be affected and further only invoices with a certain order status, like processing.

Get Beyond Compare or something similar so you can compare folders, files, contributions and see the differences made.

10-22-2009, 09:36 AM
maybe it is not too good to have register_globals set to on, because in the OSCMax installation process it seems to require they be set to off.

does batch print center 3.1.1 installed on OSCMac 2.03 still work with register globals off?

10-22-2009, 10:09 AM
I agree it's less than perfect but life is a series of decisions that we have to make.

It won't work with invoice numbers. It will error but you can use it for date ranges.
I only have reg globals on for my admin section and my catalog section is running register globals off. Since my admin is password protected and I'm the only person with access I don't sweat it too much. I have a separate php.ini for admin and catalog.

I haven't tried this but you could probably ini_set to only have certain files with globals on. Making Batch print reg globals compatible is on my list of things to do but that list is long.

By the way, Batch Print is a very productive contribution and a time saver, but as pointed out in this thread it is a little buggy.

10-22-2009, 11:46 AM
does it also error the same way in OSCommerce?

or is the error just when used with OSCMax?

10-22-2009, 11:50 AM
It's not a Max problem it's a batch print problem. It's not fully register global off compliant.