Order number prefix

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

Downloads

Compatibility: 
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.


arskipaski's picture
Offline
Joined: 02/17/2010
Juice: 99
Commiting the module to CVS

Hi there,

Great module. Would you be interested in putting it online on drupal.org CVS? That would surely create more visibility for it and allow for others to submit bug reports, feature requests and solutions Smiling

Would be cool,

Thanks,
Martin

adamo's picture
Offline
Getting busy with the Ubercode.
Joined: 02/17/2009
Juice: 229
Thanks. I certainly would

Thanks. Smiling I certainly would like to get it on drupal.org but I don't think it's really ready for release yet. If I can get the prefixed order number to show up in order lists and anywhere else the order is viewed, without hacking anything, then I'll release it on drupal.org.

arskipaski's picture
Offline
Joined: 02/17/2010
Juice: 99
Re: Order number prefix

Hey. Well, at the moment I'm using the -prefixed tokens in my themes to show up the prefixed order number everywhere.. that's not that nice but it works already.

You can always put it on drupal.org as a -dev version - that way you'll get more people to see the module and thus also more support, patches, ideas etc. At least that's what I think Smiling

Take care,
Martin

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

I'm glad it's at least somewhat useful. The drupal.org guidelines state that projects shouldn't be added to drupal.org until they are ready for release. I know there are a lot of pre-release modules on there now, but I agree with them and would really prefer it if every module listed on drupal.org was actually usable. That said, I think I will be releasing it on drupal.org fairly soon.

The issue of order lists can be worked around using Views. If I can find a way to alter the page titles on the order view and admin pages, then I think I'll be ready to release it on drupal.org.

arskipaski's picture
Offline
Joined: 02/17/2010
Juice: 99
Re: Order number prefix

Sounds cool, I'm sure there is some hook to give you what you need Smiling

adamo's picture
Offline
Getting busy with the Ubercode.
Joined: 02/17/2009
Juice: 229
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
Offline
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
Offline
Joined: 05/14/2010
Juice: 3
download

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

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

Sorry...
Where is the download link?
Thx.

leonk's picture
Offline
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.

Thanks

max36's picture
Offline
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:

Old
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
Offline
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
Offline
Joined: 09/20/2008
Juice: 630
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
Offline
Joined: 01/04/2011
Juice: 54
Re: Re: Multi store

Thanks for the tip, I will investigate that module .

jimboo's picture
Offline
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
Offline
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
Offline
Joined: 02/10/2010
Juice: 230
Re: download module

Has this module really been awaiting moderation for 18 months?

TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3266
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

<tr>.
arskipaski's picture
Offline
Joined: 02/17/2010
Juice: 99
Re: Re: Re: download module

here you go guys, had this on my machine. No guarantees about this being the latest version of the thing, but I think I downloaded it shortly before it got "lost", so..

it works though.

AttachmentSize
uc_order_prefix.tar.gz 1.08 KB
George Bobak's picture
Offline
Joined: 05/19/2010
Juice: 14
THX

You are The God! Smiling

THX