• Blog
  • Archives
  • Code
  • Talks
  • About

A bulk stock updater module for Ubercart

Note: This post is over 2 years old and may now be out of date. Some of the links not work anymore.

(1 minute read)

On a recent Drupal project I was asked to build an interface whereby administrators could easily bulk-edit the stock levels for all their Ubercart products. I had a look on the web for something which already did this. I found Multiple stock edit - which only really worked with Ubercart 1.x and Drupal 5 (not to mention that it used the standard Drupal form submission mechanism, thus making it difficult to quickly bulk-edit large numbers of items). Stock and Price updater only worked by importing CSV files. And Views Bulk Operations would only let you set the stock level to the same value across a range of products.

So I decided to build Bulk Stock Updater. It not only allows you to bulk-edit the stock levels for your entire product catalogue but uses AJAX for the editing process, thus allowing you to quickly change the values across multiple items without having to wait for page reloads. You can view your product catalogue one page at a time (the number of items per page being configurable via a variable) or you can view all the items on a single page. In the single-page view there is a Javascript-powered filter field which you can use to filter the list down to only show the items you want to edit.

I think there is scope for extending this module to allow bulk-editing of prices and perhaps other product attributes too. The AJAX-powered updating really does speed things up compared to normal form submissions.

Finally, I'm especially pleased as it's my first published module on Drupal.org :)