I think 128 characters is not enough for real life use cases. May be 255 would be great?
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | commerce_autosku-maxlength_on_sku_pattern-1189654-6.patch | 909 bytes | tmsimont |
| #1 | 1189654-1-max_length_patter_field.patch | 1.39 KB | twistor |
Comments
Comment #1
twistor commentedI agree. The database needs an update as well.
Comment #2
rbayliss commentedYeah, makes sense to me. Even 255 could probably be extended if necessary, since tokens usually take up more space than the values they replace. This brings up another point, which is that we should be limiting the length of the final SKU to commerce_product's limit of 255 characters, but I will create a separate issue for that.
Committed. Thanks!
Comment #3
rbayliss commentedJust a note that I changed this hook_update_n as per http://drupal.org/node/150220.
Comment #5
tmsimont commentedLooks like that last patch wasn't committed properly. Only the database was updated. I am using the latest dev, and there is no
'#maxlength'property set on$autosku['pattern']incommerce_autosku_form_commerce_product_ui_product_type_form_alter(which is second part of patch in #1)It looks like the default must be 128 (form API?) or something, because that's what the front end limits the input to...
Comment #6
tmsimont commentedpatch
Comment #7
rszrama commentedJust confirming this opened it up for me. I may even go further to recommend making the textfield itself wider, like to a #size of 128 or something.
Comment #8
Anonymous (not verified) commentedPatch from #6 works for me!
Comment #10
rbayliss commentedSorry I missed this. Committed the change and extended the textfield to 128 as Ryan suggested.
Comment #13
rbayliss commentedCrazy testbot. This passes all tests and has already been committed.
Comment #14
wqmeng commentedHello,
Why add the max length here, that is some human add blocker.
Here I have a pattern
[commerce-product:field_tax_processor]-[commerce-product:field-tax-ram:name]-[commerce-product:field-hard-drive-1:name]-[commerce-product:field-hard-drive-2:name]-[commerce-product:field-hard-drive-3:name]-[commerce-product:field-hard-drive-4:name]-[commerce-product:field-hard-drive-5:name]-[commerce-product:field-hard-drive-6:name]-[commerce-product:field_os]-[commerce-product:field_billing_period]-[commerce-product:field-term-bandwidth:name].You see it is very long than 255 characters, but the real sku which generated will be very short than the pattern itself.
Something will be e5-2650-8g-1tb-1tb----... , mostly of them will be less than 128 characters.
Calculate the max-length here by pattern will be no mean as the real SKU will not has the same length of it's pattern.
I have to change the length in the database to increase the pattern to be 1024, and also change the code of this module but , any time that I will upgrade this module, have to repeat the work again.
Any think?
Thanks
Comment #15
wqmeng commented