Re: auto generate SKU (using token module)?

Posts: 300
Joined: 08/28/2007
Early adopter... addicted to alphas.Not KulvikTheminator

This is something that I am interested in. It would save the effort of store admins from having to check which is the next available model number.

I built an auto-generate model number contribution for oscommerce that queries the database for the products_id and products_image or products_name fields then constructs and inserts a configurable model number like so:

XXX-YYY-001

Where:

XXX = User defined letters (usually an acronym of the store name (such as UBT for Ubercart)).
YYY = First three letters from the products_image or products_name fields (usually gives a good idea of the actual item).
001 = The products_id ensuring each model number is unique.

The problem with using this script with Ubercart is that SKU is required to add a product.

I have been thinking a little about this and (despite not knowing much about token module) I believe your idea of using token module could be the right one. There would need to be a settings page where the format would be defined - probably something like the way pathauto handles it's url formats.

Ideally the value="" of the SKU field would be prepopulated with the auto-generated model number allowing for overriding when necessary.

Sorry I haven't got more than this to offer. I can code for oscommerce but Drupal/Ubercart is still mostly a mystery to me (have bought the pro drupal development book and am working through it though so it shouldn't be long before I can contribute more)

auto generate SKU (using token module)? By: avolve (10 replies) Sat, 10/06/2007 - 18:53