I'm using setting 2 on auto sku generation: Show SKU field, but for new products give the option to Automatically Generate from replacement pattern below:
The field shows, but no matter what the user types in, "auto SKU" is what the module sees so it auto generates the sku anyway. In the module file where it goes to generate the sku, $node->model says "auto SKU" even though I entered "My test sku" so it auto generates based on the [title]-[nid] pattern I put in right.
It looks like the module is doing it's job right, but why would node->model see "auto SKU" even though the field value has been changed by the user?
Comments
Comment #1
mcaden CreditAttribution: mcaden commentedAH! I just had an inspiration right after posting this.
In the form_alter hook, case 2 should be setting
$form['base']['model']['#default_value']
instead of
$form['base']['model']['#value']
I changed it and it works.
Comment #2
kthullThis may be just what I was looking for, though my experience sounds a bit different. If I add my own SKU, node save will replace my SKU with the actual token pattern of the SKU token. So the SKU field shows something like this: [field_xxxxxxx-raw]
I'm hoping that your code change will fix my situation, but can you be a little more specific as to what line you changed and from what to what? I think I found it but not exactly sure.
Comment #3
djdevinShould be around line 82. This worked for me as well.
We have the SKU optional, and autogenerated, the tokens seemed to work fine. Make sure you have token module enabled?
Comment #4
stefan.r CreditAttribution: stefan.r commentedCommitted to 6.x-2.x
Comment #6
stefan.r CreditAttribution: stefan.r commentedPorted to 7.x