Just saw this entry in the watchdog for a test order and noticed the order (though completed) had no products/line items shown in it.
Looks to me like the database fields for a product/line item title are limited to 128 chars long, so the code should check title lengths and truncate if necessary before trying to insert into the database. And perhaps 128 should be bumped up.
Data too long for column 'title' at row 1 query: INSERT INTO uc_order_products (order_id, nid, title, manufacturer, model, qty, cost, price, weight, data) VALUES (60, 47824, 'Clap! Shake! Play! Sing! Creating Musical Storytimes to Encourage Emergent Literacy | Camarena Memorial Public Library - Calexico', '', 'placeholder', 1, 0, 0, 0, 'a:4:{s:17:\"uc_signup_enabled\";i:1;s:10:\"attributes\";a:1:{s:7:\"Pricing\";a:1:{i:0;s:12:\"Out of state\";}}s:9:\"shippable\";s:1:\"0\";s:6:\"module\";s:10:\"uc_product\";}') in /home/adam/projects/ip/app/drupal/includes/common.inc on line 3538.
Comment | File | Size | Author |
---|---|---|---|
#13 | 1113644-uc_order_product-title-length.patch | 1.6 KB | longwave |
#7 | 1113644-6-6.x-2.4.patch | 1.57 KB | adamdicarlo |
#7 | 1113644-6-6.x-2.x.patch | 1.8 KB | adamdicarlo |
#3 | 1113644.patch | 1.48 KB | TR |
Comments
Comment #1
TR CreditAttribution: TR commentedThe column {uc_order_products}.title is taken from {node}.title, so the schema should have been defined the same. In fact {node}.title used to be a varchar(128) back in Drupal 5 when Ubercart was first written, but was changed in Drupal 6 to be a varchar(255). I guess the Ubercart developers back then didn't get the memo, which is why {uc_order_product}.title is still at 128.
I'll create a patch to increase the size of {uc_order_products}.title to varchar(255). No sense in trying to make it longer than that because you won't be able to create a product node with a title longer than that.
Comment #2
adamdicarlo CreditAttribution: adamdicarlo commentedWeird, but interesting story behind that. Thanks for the fast response!
Comment #3
TR CreditAttribution: TR commentedHere's the patch. I tested it and it worked to update my D6 test site.
Comment #5
TR CreditAttribution: TR commented(Yeah, bot doesn't work on fixed-point branches like 6.x-2.4).
Comment #7
adamdicarlo CreditAttribution: adamdicarlo commentedHmm, the patch is failing to apply for me. I've tried applying to 6.x-2.4 (from the official release), and to 6.x-2.x from git.
adam@mrwalrus:~/projects/..../modules/contrib/ubercart$ patch -p0 < 1113644.patch
patching file b/uc_order/uc_order.install
Hunk #1 FAILED at 359.
Hunk #2 FAILED at 456.
Hunk #3 FAILED at 1005.
3 out of 3 hunks FAILED -- saving rejects to file b/uc_order/uc_order.install.rej
Here is the patch rerolled against both 6.x-2.4 and 6.x-2.x. The 6.x-2.4 one is a bit of a frankenstein since it includes a one-liner hook_update_N() that is in 2.x but not 2.4. Heh. This way that update won't get skipped.
Edit: Aw man, how'd this end up as comment #7? Thought it'd be #6. Oh well.
Comment #8
TR CreditAttribution: TR commentedSo did this change fix things for you?
I think the patch didn't apply because you have to do patch -p1 not patch -p0. A diff of the patches shows they're identical in all ways that matter.
Comment #9
adamdicarlo CreditAttribution: adamdicarlo commentedJust realized the product that triggered this bug was exactly 129 characters. Wow....
Comment #10
adamdicarlo CreditAttribution: adamdicarlo commented@TR: Oh right. Yep, the patch works for me! As far as I'm concerned, it's RTBC -- go ahead and change that if you want to find others to test it too.
Comment #12
rfay7.x patch in #1204374: uc_order_products and uc_order_line_items have inadequate length for 'title' fields, which has been marked a dup of this.
No wonder I didn't find this... I only looked in 7.x issues.
Comment #13
longwavePatch for 7.x based on the 6.x patch above.
Comment #14
longwaveCommitted to both branches.
Comment #16
longwaveProduct titles longer than 128 could not be edited, this has been fixed in http://drupalcode.org/project/ubercart.git/commit/540093e