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

mcaden’s picture

Status: Active » Needs review

AH! 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.

kthull’s picture

This 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.

djdevin’s picture

Status: Needs review » Reviewed & tested by the community

Should 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?

stefan.r’s picture

Version: 6.x-1.12 » 6.x-2.x-dev
Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Committed to 6.x-2.x

  • stefan.r committed 7b16c36 on 6.x-2.x
    Issue #1281612 by mcaden, djdevin: Option to to Automatically Generate...
stefan.r’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev

Ported to 7.x

  • stefan.r committed e3debc5 on 7.x-1.x
    Issue #1281612 by mcaden, djdevin: Option to to Automatically Generate...

  • stefan.r committed 3b2b9aa on 6.x-1.x
    Issue #1281612 by mcaden, djdevin: Option to to Automatically Generate...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.