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?
Comment | File | Size | Author |
---|---|---|---|
#7 | Screenshot.png | 23.46 KB | maxchock |
#1 | 1186876-1-product_token_issues.patch | 2.95 KB | twistor |
Comments
Comment #1
twistor CreditAttribution: twistor commentedHere's a first run at this. Validation still needs work I think.
Comment #2
RoSk0Thank you twistor! Patch works great for me!
Comment #3
twistor CreditAttribution: twistor commentedComment #4
rbayliss CreditAttribution: rbayliss commentedThis 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!
Comment #5
rbayliss CreditAttribution: rbayliss commentedComment #7
maxchock CreditAttribution: maxchock commentedHi.
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?
Comment #8
maxchock CreditAttribution: maxchock commentedSorry, I didn't install the latest dev version. After install problem solve.
Comment #9
rbayliss CreditAttribution: rbayliss commentedYeah, sorry about that. I just created a stable release, so this shouldn't be an issue anymore.