Order number prefix

Contrib type: 
Complete and working
Awaiting moderation


Ubercart 2.x

This module is the beginning of an attempt at getting order number prefixes implemented for Ubercart.

This is what it does:

  • Adds a field in Order Settings where you can specify a prefix to be used for order numbers.
  • Adds a order_id_prefixed property to the Ubercart order object containing the prefix + the order_id.
  • Adds 3 new tokens:
    • order-id-prefixed: The order ID with prefix applied.
    • order-link-prefixed: A link to the order using the prefixed order ID.
    • order-admin-link-prefixed: A link to the order admin view page using the order ID.

The order_id_prefixed property can be referenced by other modules and the tokens can be included in invoice templates and checkout messages.

What is doesn't do:
It doesn't modify any of the Ubercart order lists. It doesn't modify the order_id displayed when viewing or editing orders. As far as I can see, none of this can be done without modifying the uc_orders module. It doesn't store the prefixed order number anywhere in the DB. This can be done easy enough, but it seems silly to have a completely separate table just for that. Ideally I'd like to see the uc_orders module add a "alternate_key" field to the orders table. It doesn't have to put anything in there by default, but if there was a alternate_key property of the order object other modules could set it as they see fit and the uc_orders could save and load it with the rest of the order.

I hope this will at least spur some discussion and maybe we can get some changes made to core to support this kind of functionality. I would be happy to submit a patch, but I don't want to do the work and then have it be ignored.

adamo's picture
Getting busy with the Ubercode.
Joined: 02/17/2009
Juice: 225
Re: Order number prefix

FYI, I have a new version of this module that I will be posting on Drupal.org soon. There is now a sub module for Views support (requires UC Views). It allows you to use the prefixed order id in Views and provides two sample views that are drop in replacements for the orders admin and order history pages. The base module now has an option to show the prefixed id in page titles when viewing orders. Also, the prefixed order id is now stored in the database.

Docc's picture
Getting busy with the Ubercode.
Joined: 07/03/2008
Juice: 169
Re: Re: Order number prefix

adamo, how`s that new version coming along?

jon3laze's picture
Joined: 05/14/2010
Juice: 3

Am I missing something? I cannot find the download link for the life of me...

George Bobak's picture
Joined: 05/19/2010
Juice: 14
download link?

Where is the download link?

leonk's picture
Joined: 01/15/2010
Juice: 128
Re: Order number prefix

Yes a download link would be useful.

Even if the module is being redeveloped, I would find it very beneficial to see the current code.


max36's picture
Joined: 03/06/2009
Juice: 3
Alternative Solution

If it's just about adding a simple prefix I assume one could use the modul Stringoverrides and rewrite all strings containing "order number" or the [order ID]-Token to sth. like this:

Display "Subject: order number <i>[order ID]</i>"

New with Prefix
Display "Subject: order number <i>YOURPREFIX--[order ID]</i>"

alltough not fully tested it seems to work for me Eye-wink

jimboo's picture
Joined: 01/04/2011
Juice: 54
Multi store

I am working on a multi-store solution(all using same products) and at the moment am going down the multi(sub)domain route, which I dont like because I dont have overview of all data and I have to export products to each of 7 store subdomain dbs.
It would be much better if it could be in one db.

A simple solution could be to set an order prefix based on which store is selected then each store could have a role with access only to a certain prefix and admin order views etc could be limited to a specific prefix.
I think your module sets up one prefix for use for all orders.
Could this solution be achieved using this module... if so, and being a noob to custom modules, any pointers on how I would go about it would be great.

longwave's picture
Joined: 09/20/2008
Juice: 626
Re: Multi store

http://drupal.org/project/uc_domain lets you run stores across multiple domains from a single database using Domain Access, and also provides an order ID prefix token that you can set per domain and then output in your invoices.

These forums are for general support questions about Ubercart.
Bug reports and feature requests should be posted at http://drupal.org/project/issues/ubercart
Latest API documentation can be found at http://api.ubercart.me/

jimboo's picture
Joined: 01/04/2011
Juice: 54
Re: Re: Multi store

Thanks for the tip, I will investigate that module .

jimboo's picture
Joined: 01/04/2011
Juice: 54
Re: Re: Re: Multi store

Had a quick look. Before I download and try out Uc-domain, do you know if It will allow me to use the ordid prefix token to determine where the checkout email(to storeadmin) goes? and can the storeadmin order view be limited to one domain?

My use case is slightly different from the one described in the module, all customers will access an identical frontend to purchase orders but the order will be routed to a particular store based on region. I would like each store to have their own view of their orders in store/admin/orders... Thats why I was considering order-prefix.
Thanks for your input

ocsinet's picture
Joined: 01/10/2011
Juice: 4
download module

Sorry, i would like to try this module, but i really can't find where to download it, really sorry, newby in this site Smiling

csdesignco's picture
Joined: 02/10/2010
Juice: 220
Re: download module

Has this module really been awaiting moderation for 18 months?

TR's picture
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3277
Re: Re: download module

Nobody "moderates" submissions to this site. Looks like the link to the module got lost in the site upgrage - you should e-mail Andy about that: http://www.ubercart.org/user/5

George Bobak's picture
Joined: 05/19/2010
Juice: 14

You are The God! Smiling