Hi, This is the error I get when I try to add many products to a single product kit. Is there a limit, i may have to add more than a 100..
PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'model' at row 1: UPDATE {uc_products} SET model=:db_update_placeholder_0, list_price=:db_update_placeholder_1, cost=:db_update_placeholder_2, sell_price=:db_update_placeholder_3, weight=:db_update_placeholder_4, weight_units=:db_update_placeholder_5, default_qty=:db_update_placeholder_6, ordering=:db_update_placeholder_7, shippable=:db_update_placeholder_8 WHERE ( (vid = :db_condition_placeholder_0) ); Array ( [:db_update_placeholder_0] => FRE-004AR / FRE-004CR / FRE-004GE / FRE-004LA / FRE-004MO / FRE-004SA / FRE-007AR / FRE-007CR / FRE-007GE / FRE-007MO / FRE006-AR / FRE-006CR / FRE-006GE / FRE-006MO / FRE-008AR / FRE-008CR / FRE-008GE / FRE-008MO / FRE-005AR / FRE-005CR / FRE-005GE / FRE-005MO [:db_update_placeholder_1] => 892 [:db_update_placeholder_2] => 0 [:db_update_placeholder_3] => 892 [:db_update_placeholder_4] => 0 [:db_update_placeholder_5] => lb [:db_update_placeholder_6] => 1 [:db_update_placeholder_7] => 0 [:db_update_placeholder_8] => 1 [:db_condition_placeholder_0] => 284 ) in uc_product_kit_update() (line 342 of /home/mercato7/public_html/dev/sites/all/modules/ubercart/uc_product_kit/uc_product_kit.module).
Thanks!
Jaya
Comment | File | Size | Author |
---|---|---|---|
#17 | ubercart-product_kit_sku-2006180-17.patch | 4.15 KB | hanoii |
|
Comments
Comment #1
TR CreditAttribution: TR commentedThe model (SKU) of the product kit is automatically set to be a concatenation of the individual product models for the products in the kit. In your case, the resulting model exceeds 256 characters (the maximum allowed length of a model), which is why you see an error.
I suppose we should find a better way of automatically generating a product kit model. Just truncating it at 256 isn't sufficient because that might lead to multiple kits with the same model. Changing the size of this database field is the wrong thing to do, that just moves the point where the error occurs, and 256 is already quite large enough to hold single product models. A hash could be used; those typically aren't very "readable", however this may be the best way to go about it. Maybe the kit model should be this string "KIT" with a 32 character hash code appended?
Comment #2
j4 CreditAttribution: j4 commentedMaybe I should also point out that while the error appears, the products do get added to the kit. Am afraid am a novice, so wouldnt know about changing kit model to string KIT with a hash. Would you be able to upload a patch and I could test it out?
Thanks for the fast reply!
Jaya
Comment #3
TR CreditAttribution: TR commentedIf you're willing to ignore the error, which should appear only when you create the product kit, then everything from then on should work correctly. The product kit model number gets truncated, which is not ideal, but will work.
Comment #4
longwaveComment #5
j4 CreditAttribution: j4 commentedThank you. That will work for now.
Jaya
Comment #6
TR CreditAttribution: TR commentedLet's leave this open until we have a fix that eliminates the error.
Comment #7
j4 CreditAttribution: j4 commentedHi Just wanted to add that sometimes, I am having to add the products in batches of 3-4, and sometimes, even then go through the process 3-4 times before it accepts it.
Thanks
Comment #8
longwaveWe could just add an SKU field for kits, so the user can specify one. Not sure if or how kits work together with stock tracking, we could perhaps make the SKU field optional if kits don't really need SKUs at all - surely the individual products in the kit should be the stock-keeping units.
Comment #9
j4 CreditAttribution: j4 commentedThank you Longwave and TR for taking the time with this. Actually while I continue to upload I find that I am actually not able to go beyond a number and as usual the error appears but no products get added. So this has become a priority issue with me as my site goes live in about 2 days. Is there anyway I can help with any patch that could make the product kit SKU not mandatory as in my site, we sell only individual products. We only use the product kit to assemble them together.
Thanks again!
Jaya
Comment #10
j4 CreditAttribution: j4 commentedWould this link be helpful to us?
http://www.ubercart.org/issue/4245/data_too_long_model_column_uc_order_p...
Jaya
Comment #11
chellman CreditAttribution: chellman commentedI have a site that's being affected by this issue as well.
I feel like using a hash for the model makes sense, or maybe making the model optional so kits don't need it, since stock would be tracked on the individual products that make up the kit. Either that, or expose the SKU on node edit forms so we can set one that won't run up against this error.
Comment #12
chellman CreditAttribution: chellman commentedAll right, for my purposes, a simple solution of hard-coding the SKUs to "kit+nid" is good enough. In case that ends up being useful, here's a patch.
Comment #13
chellman CreditAttribution: chellman commentedComment #15
hanoiiUnbelievable something like this was not fixed since then, it's very likely that product kits is the least used feature in ubercart :), although I used it a bit and this issue has just showed up in one of our clients.
Attached is a patch that does pretty much what @longwave suggested in #8, however, I didn't made SKU optional as that assumption could possible do more harm in how ubercart works internally. Instead I am simply making SKU required as per a normal product. It's really the most sensible fix for something like this, and won't change current product kits models.
Comment #17
hanoiiFixing tests, I think the taxonomy ones are unrelated to this issue.
Comment #19
hanoiiok, only this taxonomy test failing which is likely a work in progress of some other issue.
Comment #20
TR CreditAttribution: TR commentedThe test failure was due to a disruptive Drupal core commit that broke the test. I fixed the test in #2746103: D7.50 change breaks test.
Comment #21
TR CreditAttribution: TR commentedComment #22
1computerninja CreditAttribution: 1computerninja as a volunteer commentedUbercart 8.x
CLI postgre db fix: "alter table uc_products alter model type varchar(255);" resolved the issue for me.
I would assume a mysql db would resolve in a similar way.
Is there anyone working on getting the additional field length put into the next Ubercart update?
Comment #23
TR CreditAttribution: TR commented@1computerninja: Please read the issue. Increasing the length of the model field is NOT a solution here, and this issue has nothing to do with whether you use PostgreSQL or MySql. In fact, in 7.x-3.x the model length WAS 255, and yet we still had this issue. In 8.x-4.x the length was deliberately reduced to 40 characters, which exacerbates this issue but doesn't affect the possible solution which was suggested by @longwave in #8 with a patch provided by @hanoii in #17. To help, you can test the patch from #17 for 7.x-3.x, or port that patch to 8.x-4.x and post it here for consideration.