This is actually a few things somewhat interrelated.
First off, "product" is used rather than "commerce-product" when adding the helper from token.module which means no product tokens are available. Same problem exists with the hand rolled token implementation.

Second, the pattern text field shouldn't be allowed to be empty if "Automatically Generate SKU" is checked. This is a bit annoying since it's a conditional element and making the required bit conditional doesn't actually make it required. It can't be normally required since that would mean it's required even if "Automatically Generate SKU" is unchecked. So we make the required conditional which gives us the red asterisk but have to check manually anyway.

Third, manual validation is still necessary when using the token.module helper, since product sku can't be used.

Finally, I'm not sure about allowing only product tokens. Why couldn't the timestamp be used as part of the token?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

twistor’s picture

Here's a first run at this. Validation still needs work I think.

RoSk0’s picture

Thank you twistor! Patch works great for me!

twistor’s picture

Title: Product token issues. » Product tokens unavailable.
rbayliss’s picture

This patch is looking really good. Commerce product switched the entity name where tokens are concerned right before this module came out, and I guess I didn't make the change everywhere. Anyway, to answer your question, the reason we're only allowing product tokens without the token module is to keep this module's native token display and validation to a minimum, without outright requiring the token module. I'll gladly accept patches to include other token types as long as they're likely to be frequently used.

This patch has been committed to the dev branch because it fixed a critical bug, and if I can figure out a way to update the beta4 release, I will do so. Twistor, you mentioned that you may have more work to do on the validation, so I'll leave this issue open for you to close at your discretion. Thanks!

rbayliss’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

maxchock’s picture

Status: Closed (fixed) » Active
FileSize
23.46 KB

Hi.

I just install the latest version of autosku, but seems the Product token are missing?? picture i attached explain it all.

Or I didn't configure it correctly?? Did I?

maxchock’s picture

Status: Active » Closed (fixed)

Sorry, I didn't install the latest dev version. After install problem solve.

rbayliss’s picture

Yeah, sorry about that. I just created a stable release, so this shouldn't be an issue anymore.