My SKU naming system for products uses integers like 10001, 10002, etc. Next product added should just get the next available number.
Therefore I would like automatic generation of SKU so that the SKU for the next product is +1 higher than the last product added.
(Similar to AUTO_INCREMENT column in a MySQL table)
Example:
- Highest SKU so far is 10213
- Next product added will get SKU 10214
This seems like a basic feature?
I noticed the Unique SKU contib module which may or may not do what I want. But it is apparently for Ubercart 1 only.
http://www.ubercart.org/contrib/4312
Is there a way to achieve this with Product Power Tools?
Note: I am aware that Product Power Tools can autogenerate SKU based on node id. But since I have other node types than products, this is not quite what I want.
Comments
Comment #1
willvincent CreditAttribution: willvincent commentedI don't believe this can be done presently, but I've added it to the list.
Comment #2
nodiac CreditAttribution: nodiac commented+1 for Auto Increment! Yes! Please!
Every Ubercart site I've built has had sequential skus as a requirement.
Comment #3
design.er CreditAttribution: design.er commentedHello, nearly 1 year has passed since this feature request. Is it already possible?
Edit: Oh nice, it's already possible. I used the drupal.org search and thought I'm in Übercart's issue queue - didn't realize that this is an other module. It's pretty handy. Thanks a lot! :)
Comment #4
Stomper CreditAttribution: Stomper commentedCould you explain how you did it/basics of setting up a custom auto SKU, please?
Comment #5
nodiac CreditAttribution: nodiac commentedYes! Please!
Comment #6
Stomper CreditAttribution: Stomper commentedAgreed, directions please.
Comment #7
TR CreditAttribution: TR commentedNew features will go into the Drupal 7 version first. A patch to implement this feature would be highly appreciated.
Comment #8
jonathan_hunt CreditAttribution: jonathan_hunt commentedHere's how I solved it in D6, via a hook_form_alter():
Comment #9
Stomper CreditAttribution: Stomper commentedWhere do we insert this code?
Comment #10
jonathan_hunt CreditAttribution: jonathan_hunt commented@Stomper That would go in a hook_form_alter() in a module you create.
Comment #11
Stomper CreditAttribution: Stomper commentedSo there's no way to generate an auto SKU without a custom module?
Comment #12
JordiTR CreditAttribution: JordiTR commentedIf you create a module that's the proper way to add #8 in Drupal 7:
Thanks Jonathan Hunt!
Comment #13
iantresman CreditAttribution: iantresman commentedI would guess this could be done in conjunction with the CCK Serial Field module which "provides an auto-increment (serial) field", which in turn can be used as a CCK file tokens in the Pattern for the SKU.
Comment #14
caco13 CreditAttribution: caco13 commented@iantresman, could you explain how to do that?