Bulk Order Operations

Contrib type: 
Module
Status: 
Complete and working
Moderation: 
Awaiting moderation

Downloads

Compatibility: 
Ubercart 1.x

Allows the following bulk operations for orders - feel free to suggest others:

(1) Print multiple invoices
(2) Change order status
(3) Export delivery addresses to csv file (for labeling etc.)

To perform bulk operations, go to admin/store/orders/bulk_ops

Don't forget to set user access level.

Suggestions for improvement, and bug reports, are very welcome.

PreviewAttachmentSize
uc_order_bulkops.zip3.15 KB
uc_order_bulkops - new version for UC 1.zip - see comment below 7/4/2009 for added functionality5.56 KB
hvitebjorn's picture
Offline
Joined: 07/26/2008
Juice: 85
Re: Bulk Order Operations

Uploaded new version January 2, 2009.

hvitebjorn's picture
Offline
Joined: 07/26/2008
Juice: 85
Re: Re: Bulk Order Operations

Added new version January 4, 2009. This one includes an option to export names and addresses associated with orders. We use this with automatic labeling software for shipping.

thill's picture
Offline
Joined: 01/25/2008
Juice: 815
Re: Re: Re: Bulk Order Operations

I think this is a good start to the problems for Ubercart 1.X, hopefully it can be upgraded nicely for 2.X with integration into order status selection and triggers/actions or CA.

It would be nice to "Select all orders payment received" then you can select print.

Also would be nice to create a entry in the DB for "order printed" this way you could do a setting of if payment received and order printed set status to "picking, or ready for shipment"

It is a great thing for 1.x users now though. Very nice.

Jurgen8e's picture
Offline
Joined: 10/02/2008
Juice: 87
Hi, I want to send mails on

Hi,

I want to send mails on bulk status update. I don´t find how this is done on /admin/store/orders/40.
I tried the following, not succesfull: (it only adds a message to the order, says customer is notified)

function _uc_order_bulkops_set_status($status, $orders) {
  db_query("UPDATE {uc_orders} SET order_status = '%s' WHERE order_id IN(%s)", $status, implode(',', $orders));
 
  foreach($orders as $order_id) {
    uc_order_comment_save($order_id, 1, '-', 'order', $status, TRUE);
  }

}

How can I send these mails?

I also have many problems with special characters through the .csv export, like ë,...

But thanks for this great module !!!!

Jurgen8e's picture
Offline
Joined: 10/02/2008
Juice: 87
Re: Hi, I want to send mails on

For sending the mails it has something todo with 'uc_notify_order_update' in uc_notify.module, but I did´t get it.

I copy past the code, and it works.

function _uc_order_bulkops_set_status($status, $orders) {
  db_query("UPDATE {uc_orders} SET order_status = '%s' WHERE order_id IN(%s)", $status, implode(',', $orders));
 
  foreach($orders as $order_id) {
$order = uc_order_load($order_id);

    $body = variable_get('uc_notify_order_update_body', uc_get_message('order_update_email'));
    $body = token_replace_multiple($body, array('global' => NULL, 'order' => $order));

    $subject = variable_get('uc_notify_order_update_subject', t('Order #[order-id] Update'));
    $subject = token_replace_multiple($subject, array('global' => NULL, 'order' => $order));

    $email_to = $order->primary_email;
    $headers = uc_notify_headers();

    $sent = drupal_mail('order_comment', $order->primary_email, $subject,
                        check_markup($body, variable_get('uc_checkout_status_format', 3), FALSE),
                        uc_store_email_from(), uc_notify_headers());

    uc_order_comment_save($order_id, 1, '-', 'order', $status, TRUE);
  }

}

kevster's picture
Offline
Joined: 09/03/2008
Juice: 19
update to 2.x

This is a very useful module and have used in 1.x but wondered if you have any plans to update to 2.x?

If not we may have a go at upgrading.

Thanks, Kevin

ktf
ktf's picture
Offline
Joined: 06/22/2009
Juice: 84
Re: update to 2.x

I second the request for a 2.x version. This is definitely a necessary module!

And if anyone else updates it, please contribute it so we can all reap the benefits.

EDIT:
I got this running in UC2. Here's how:
1) I ran Deadwood to convert the basic stuff to Drupal 6
2) In the uc_order_bulkops_menu() function, I commented out the if($may_cache) check. This was keeping the page from loading, I don't know why.
3) I added the following theme hook:

function uc_order_bulkops_theme() {
  return array(
    'uc_order_bulkops_list_form' => array(
      'arguments' => array('form' => NULL),
    ),
  );
}

4) I cleared the cache on my site

I believe that's everything. Keep in mind I don't know ANYTHING about Drupal/UC coding, I just hacked at it until it worked. So if any of this is wrong or dumb or doesn't work for you... sorry!

kevster's picture
Offline
Joined: 09/03/2008
Juice: 19
Re: Re: update to 2.x

Thats great you got it working - any chance of you posting your code up to save us going through deadwood etc?

thx - Kevin..

hvitebjorn's picture
Offline
Joined: 07/26/2008
Juice: 85
Updated version for UC 1

I added some new functions - if you DO NOT need these functions there is no need to upgrade. Some of these may be too specific to any particular store apart from my own. These are the new functions:

(1) Flags for printed invoices and exported invoices (helps you remember which ones are printed/exported)
(2) Simple workflow management:
(a) Check that an order has status "Payment received" before it is printed. If payment is not received, you will get an error message
(b) Automatic promotion to order status "Processing" once an invoices is printed
(3) Added a function to bulk-charge credit cards from prior authorizations.

I left both the new and old version up on the top of the page.

sphism's picture
Offline
Bug Finder
Joined: 11/29/2007
Juice: 215
UC 2.x?

Hi there, I love this module, is it going to be updated to ubercart 2.x? If not then i'll try the deadwood method mentioned above.

Thanks

jpstuddard's picture
Offline
Joined: 08/27/2009
Juice: 27
Is there a UC2.x version of this available?

We really need the bulk status update functionality, has anyone successfully ported this to UC 2.x/D6.x?

jpstuddard's picture
Offline
Joined: 08/27/2009
Juice: 27
uc_order_bulkops 2.0

Ok, after some googling and trial and error, I have a functioning uc_order_bulkops module running on Drupal 6.14 and Ubercart 2.0-rc7.

Here is what I did:
1. I took "uc_order_bulkops - new version for UC 1.zip" and recompressed to a .tar.gz
2. I uploaded it to http://boombatower.com/tools/deadwood which cranked me out a D6 Compatible version of the Module.
2. I then pasted discostoo's theme tweak code from post #7 in the bottom of uc_order_bulkops.module
3. Flushed all caches and it seems to be working pretty well.

I have attached the working tarball to this post. I don't know how to repost/submit properly as an updated contributed module for Ubercart 2.0 so maybe someone can take this file and post it correctly.

AttachmentSize
uc_order_bulkops-6.x-2.x-dev.tar.gz 5.98 KB
rhubarb-media's picture
Offline
Joined: 11/04/2008
Juice: 23
Database error

I'm running Ubercart 2.0 with Drupal 6.14. I installed the ported module that jpstuddard created (comment #12), and the bulk operations page loaded fine. However, I got a database error when I tried to sort the orders by customer name. It looks like there are still some compatibility issues.

Here's the error:

user warning: Unknown column 'billing_name' in 'order clause' query: SELECT o.order_id, order_status, title, order_total, billing_first_name, billing_last_name, order_total, created, order_status, printed, exported FROM drupal_uc_orders o INNER JOIN drupal_uc_order_statuses os ON o.order_status = os.order_status_id LEFT OUTER JOIN drupal_uc_order_bulkops ob ON ob.order_id = o.order_id ORDER BY billing_name ASC LIMIT 0, 30 in /[MY_PATH]/modules/ubercart/contrib/uc_order_bulkops/uc_order_bulkops.module on line 171.

duckx's picture
Offline
Cool profile pic award.
Joined: 02/27/2008
Juice: 300
Re: Database error

in reply to #13.. i was able to fix the name issue. its just a temporary fix as all i did was open up the .module file and find and replace:

FIND: billing_name

REPLACE WITH: billing_first_name

if you found this useful, please reply so we can get someone more versed in fixing this sorting issue. i'm still getting errors for the other columns tho.

rhubarb-media's picture
Offline
Joined: 11/04/2008
Juice: 23
Seems to be working now

Thanks ducky911. I haven't had time to test it extensively, but your "find and replace" fix seems to have solved the problem. Hopefully that was the only migration issue.

quikone's picture
Offline
Joined: 02/28/2009
Juice: 578
This is Great

Thank you to all who have contributed to this. It is exactly what I have been looking for. Does anyone know if this will be added to the Ubercart core or how we can request it?

lpkb@drupal.org's picture
Offline
Joined: 11/18/2009
Juice: 2
Great, I agree. (And a suggestion)

Thanks -- this is an important module!

One thing I'd love is the ability to send a simple boiler-plate update email when the orders are marked "Completed." Something indicating it's shipped, etc, maybe with a copy of the invoice, which can be customized in the admin panel and then can be sent (or not) when the order status is changed from the bulk menu.

stripped your speech's picture
Offline
Joined: 11/10/2009
Juice: 35
Re: Bulk Order Operations

I don't understand. The invoices don't print for me, they just get flagged as Printed and disappear.

Is this actually supposed to bulk print invoices to my printer?

ktf
ktf's picture
Offline
Joined: 06/22/2009
Juice: 84
Re: Bulk Order Operations

I'm having a similar problem with printing. It's strange though -- on my local test machine, running Ubuntu 9.04, printing works perfectly. But on the remote install, hosted on Hot Drupal, printing doesn't work. Maybe it's a PHP version issue or something?

I really don't understand how this functionality isn't built in to Ubercart. It seems like it would be impossible to run a store without being able to handle more than one order at a time.

EDIT:
It appears that the final "print $output;" in _uc_order_bulkops_print_invoices() isn't doing anything for some reason. The function is definitely getting called though... I can add a drupal_set_message() after that line, and it shows up after hitting "Print". I don't get what could be going on here.

SECOND EDIT:
Okay, after poking around in ubercart's uc_order code, I tried just adding a call to "exit();" after the "print $output;" in _uc_order_bulkops_print_invoices(). It works now, on both local and remote installs. Yay! I don't pretend to know why, but try that if yours isn't printing correctly.

sterg17's picture
Offline
Joined: 05/20/2009
Juice: 126
Re: Bulk Order Operations

I have this error after installing the module above on ubercart cart 2 drupal 6 (all updates in polace):

Fatal error: Cannot redeclare _uc_order_bulkops_view_invoice() (previously declared in /home/..../modules/uc_order_bulkops/uc_order_bulkops.module:392) in /home/..../modules/uc_views/uc_views_bulk_operations/uc_views_bulk_operations.module on line 93

anyone know the reason?

sterg17's picture
Offline
Joined: 05/20/2009
Juice: 126
Re: Re: Bulk Order Operations

I went in and deleted the function from the uc_views module and that seems to have fixed it, but I am scared if it may break something else...

if anyone has had this problem, or knows whats up, please post. Thanks!

madsph's picture
Offline
Joined: 02/25/2009
Juice: 56
Re: Re: Re: Bulk Order Operations

I think the one that supplied the patch to enable bulk operations for uc_views must have copied some code from this project and forgot to rename the function.

I have made a patch for uc_views to remove this problem.

I am truly sorry that this could slip through my review Sad

By renaming the function in uc_views you shouldn't have broken any thing, the bulk operation from that module will now use the function from this module to display the invoice - if you want uc_views to continue using it's own function - you will need to change the call in the uc_views_bulk_operations_orders_print_orders function in uc_views_bulk_operations.module to use the renamed function.

duckx's picture
Offline
Cool profile pic award.
Joined: 02/27/2008
Juice: 300
Re: Bulk Order Operations

anyone know whats the difference from this module and uc_views?

im guessing this is the updated module:

http://drupal.org/node/389396/cvs-instructions/DRUPAL-6--3

madsph's picture
Offline
Joined: 02/25/2009
Juice: 56
uc_views

I maintain the uc_views project, which is an effort to provide views support for ubercart modules that lack these capabilities, along with good sample views to give people a head start.

So my project is more of a general purpose project, bulk operations just being one of the possibilities - but far from a main focus.

I don't know this project (Bulk Order Operations) well - but I guess it is more specialized in providing the bulk operations.

hope that helps.

bass28's picture
Offline
Joined: 05/10/2010
Juice: 19
Fedex export added

I am new to Drupal and Ubercart so I am not sure the maintenance of such modules work. I have, however, added an option to the drop down to export a csv file to be imported into the Fedex Shipping Manager software. Is this something you want to include or not bother with?

ktf
ktf's picture
Offline
Joined: 06/22/2009
Juice: 84
Re: Bulk Order Operations

I just wanted to reiterate that if you use UC2, you should check out the Ubercart Views module for this functionality (and more!): https://drupal.org/project/uc_views

It seems to be less temperamental than the Deadwood-hacked-together version of uc_order_bulkops I was using before Smiling

jordotech's picture
Offline
Joined: 06/26/2010
Juice: 37
Views Bulk Operations + uc_views accomplishes this

This seems like a very unnecessary module, its functionality already exists with VBO + uc_views. I'm successfully bulk printing invoices in certain date ranges.

sterg17's picture
Offline
Joined: 05/20/2009
Juice: 126
Re: Views Bulk Operations + uc_views accomplishes this

Can you explain how you use h VBO + uc_views to PRINT all the invoices? I have no clue....

I used to use the bulk operations module- but doesnt work anymore!

jordotech's picture
Offline
Joined: 06/26/2010
Juice: 37
Re: Re: Views Bulk Operations + uc_views accomplishes this

I don't know if it will work for you but I've attached an export of the view. I'm really busy, if that doesn't work I'll post step by step later on. Let me know if it works.

AttachmentSize
bulk print.doc 59 KB
sterg17's picture
Offline
Joined: 05/20/2009
Juice: 126
Re: Bulk Order Operations

where should I put the code?

Whenever you have free time - the walk through would be appreciated!

jordotech's picture
Offline
Joined: 06/26/2010
Juice: 37
Re: Bulk Order Operations

use the import views feature of views, you'll just paste that code into that interface.

sterg17's picture
Offline
Joined: 05/20/2009
Juice: 126
Thanks Bud. I need to upgrade

Thanks Bud.

I need to upgrade my Views from 2.0 to 3.0 and then I will import it. It wouldnt let me import with V2.

I will let you know how it works out. Thanks alot,

sterg17's picture
Offline
Joined: 05/20/2009
Juice: 126
Re: Bulk Order Operations

This is the error message I am getting when importing the view:

Field handler uc_orders.order_balance is not available.
Field handler uc_orders.weight is not available.
Field handler uc_orders.billing_full_name is not available.
Field handler uc_orders.order_balance is not available.
Unable to import view.

doublejosh's picture
Offline
Joined: 09/26/2009
Juice: 55
Ubercart Product Actions module

Feel like I should post a link to the Ubercart Product Actions module here.
http://drupal.org/project/uc_product_actions