It looks like the replacement pattern field (product_type[autosku][pattern]) is setting the character limit to 255. For now, I guess I'll override that with the form API but would it be possible to update this? Entity auto label's field settings seem appropriate from a user's standpoint. Without looking at the code I'm pretty sure it's a textarea with 4 rows. I don't know the character limit.

I'll post my workaround here for anyone interested once I've got it tested.

Comments

pulliMan’s picture

I'm suffering the same issue, that for my usecase I'd need more than 255 characters.
So I was happy to read, that you as well were wishing a solution like in Entity auto label.
Did you manage to do your workaround already?
I'd be very happy to benefit from your patch, because unfortunately I'm still at the very beginning in learning Drupal and not yet(!) able to fix such things by myself.

dwatts3624’s picture

Status: Active » Needs review
StatusFileSize
new1.57 KB

So I tried implementing hook_schema_alter() and hook_form_alter(). I got far but apparently, I don't understand how hook_schema_alter() works since it doesn't seem to actually make any changes to the database.

In any case, I feel like we're probably not the only people who need a longer field here so I'm submitting at patch. This will only work if you uninstall the old version, apply it, then re-enable. Since one of the updates was actually already increasing the size of the field (though not enough) I wasn't sure how to handle the hooks so I just re-wrote that one. Hope I didn't do anything terribly wrong there. I've been trying to participate more with patches but am still a bit of a newbie.

pulliMan’s picture

Hi,

thankyou for your answer,
meanwhile I tried something similar, even more primitive...
It is certainly not the way one is supposed to do it, but it works for now..

function commerce_autosku_update_7101(&$sandbox) {
@@ -42,5 +42,5 @@ function commerce_autosku_update_7101(&$sandbox) {
'description' => 'Token replacement pattern.',
'type' => 'varchar',
- 'length' => 255,
+ 'length' => 500,
'not null' => TRUE,
);

rbayliss’s picture

Status: Needs review » Fixed

We're limited to 255 characters in the SKU because of the database restrictions, but you're right - there's no reason the pattern can't be longer. I added an update hook to make this column big text, and removed the limit from this field. I'm not in favor of making the pattern field a textarea though. Thanks!

Status: Fixed » Closed (fixed)

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

joelstein’s picture

Issue summary: View changes

Please see the follow-up issue at #2868735: Character limit (still) set at 255.