0

I'd like my sku's to be generated automatically. Every product I add should have a numeric sku that simply increases by 1 each time.

I have found tutorials that show you how to do this. They suggest editing app/design/adminhtml/default/template/catalog/product/edit.phtml

Calling the last sku and auto populating the sku field with javascript.

The problem with this is what if 2 people are adding products at the same time?

Potentially they will both call the same 'last sku' and when one of them tries to save they will get an error. This will be happening often for us.

A better way is to create the sku upon saving the product.

How could I acheieve this?

Lucas Scholten
  • 925
  • 4
  • 22
  • 40

1 Answers1

0

Check user session ID then do what you want.

<?php echo Mage::getModel("core/session")->getEncryptedSessionId(); ?>  

or check this topic to get unique UUID with javascript :

How to create a GUID / UUID in Javascript?

Community
  • 1
  • 1
Oğuz Çelikdemir
  • 4,990
  • 4
  • 30
  • 56