Is there a way to auto increment SKU with ubercart or tip that folks use to help them remember what the next available SKU is if they are making them up as they go?
I found a sandbox module for Drupal, but I don't think it's been ported and I'm not even sure if it's a Drupal 7 module (created in 2013, so it probably is):
https://www.drupal.org/sandbox/grobot/2105379
Comments
SKU = Stock Control Unit... meaning an easy way to identify stock...
Depending on the type of stock item you have, would dictate the SKU.
So, for example, in the IT industry, we tend to break the SKU down into sections...
So, for example,
A hard drive would be something like...
HD = Hard Drive
SEA = Seagate
Remainder the part number from the manufacurer
HD-SEA-ST8DM004
HD-SEA-1800018TB
A monitor may be
MON-VIE-VA3209MH
Etc...
But, saying that...
I've just converted my old CRM from Visual Foxpro into Backdrop and I wanted a way to autoincrement our job tracking number...
Here's the code
/**
* Implements hook_node_presave().
*/
function acscustom_node_presave($node) {
// Check if the node is of a specific content type.
$content_type = 'task_main';
if ($node->type == $content_type) {
if ($node->title == '') {
$acsserialno = config_get('acscustom.settings','taskserial');
$acsserialpre = config_get('acscustom.settings','taskprefix');
// $node->title['und'][0]['value'] = 'New value';
$acsref = '';
$acsref = $node->title;
++$acsserialno;
$node->title = $acsserialpre . strval($acsserialno);
config_set('acscustom.settings','taskserial', $acsserialno);
}
}
}
/**
* Implements hook_form_FORM_ID_alter() for the task-main node form.
*/
function acscustom_form_task_main_node_form_alter(&$form, &$form_state, $form_id) {
$form['title']['#required'] = FALSE;
}
If the site has multiple people all creating new products at the same time, you may get the same SKU... if they save at the exact time... for me, it's not an issue.
Can't remember what it's called where you implement a serial number that is always unique.
Hope this helps
Tried and successfully applied DrAlbany's method with the form https://www.drupal.org/sandbox/grobot/2105379stickman hook. I also encountered the same situation. Thanks DrAlbany