Closed (fixed)
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Cart
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 May 2011 at 14:57 UTC
Updated:
24 Aug 2011 at 02:31 UTC
aristeides, in #1107788-15: Unknown data property commerce_product. in EntityStructureWrapper->getPropertyInfo(), provided a database where when you add to the cart, you get the message
EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. in EntityMetadataWrapper->set() (line 110 of /home/rfay/workspace/commerce/sites/all/modules/entity/includes/entity.wrapper.inc).
I note that this warning is displayed when visiting the product line item type configuration page at admin/commerce/config/line-items/product/fields, even though the product reference module is in fact enabled:
Error message
Inactive fields are not shown unless their providing modules are enabled. The following fields are not enabled:
Product (commerce_product) field requires the Autocomplete text field widget provided by commerce_product_reference module
@aristeides, if you would give us information on when you created this test site, how you created it, etc. that would be great.
Comments
Comment #1
heyyo commentedI have the same error by updating to last dev throw update UI (not drush):
Comment #2
heyyo commentedi finally succeed to install the last dev commerce by removing commerce directory and by redownloading a fresh commerce.tar.gz.
I was using drush before...
Comment #3
rfay@heyyo, your issue is not related to this one. And it sounds like you've resolved it by using current code.
Comment #4
heyyo commentedIt seems to be the same error:
and you're right I resolved it with fresh last commerce dev:
But these errors are still presents:
I will open another issue for this thanks,
Comment #5
rfay@heyyo, yours is during an update. The original report was when adding to the cart. It's unfortunate that these EntityMetadataWrapperException errors give such poor information.
@rszrama, we should probably figure out a method to get a backtrace presented for these problems. Or stop using the wrapper.
Comment #6
mikejoconnor commentedTalked to rszrama. We think this is related to #1173208: Add a default field integrity checker.
Marking as duplicate.
Comment #7
jlab commentedI'm getting the same type of errors the site was running fine and proper even after migrating to Drupal-7.4 we use the commerce_product_display_manager to add the product display references.
The site was installed with the commerce_kickstart install profile.
We thought everything was running perfect for a while and the client started adding about 200+ new products and everything went smooth until this ugly error popped up it's head.
Now I'm not sure whether this is caused by commerce or commerce_product_display_manager.
Now we can't add any Product Display references to our products.
I installed the commerce_devel module to add the stack trace the error message is as follows:
Is there any way to get this little beast out of the way?
Any help would be greatly appreciated. I could also provide DB dumps etc.
Comment #8
rfayI think #1173208: Add a default field integrity checker is a great idea, but going to unmark this as a dup.
#7: The stacktrace you give is for a cron run. that doesn't seem to match what you're saying. Or there's something really bad going on.
If you get me the database I'll look at it. randy at randyfay.com, attach to the issue, send via dropbox, or whatever. Feel free to obfuscate the emails and passwords.
Comment #9
rfay#7: I am unable to get any trouble using the database you sent. Please provide step-by-step instructions on how to get this error. I've created a product display node, and even have run cron.
Comment #10
jlab commentedThe commerce side worked fine for quite a few days between us and the client it has already uploaded 200+ products. I have no idea to replicate this error step by step...
I will be loading a backup from when the site still worked before the errors, some of the people working along on the site loaded some contributed modules before the message started we will try and monitor and see if this error happens again.
I was hoping that I could somehow save the site and keep the 200+ uploaded products...
I tried migrating the site to a new platform but just got new error messages:
I will keep a close eye on what the other people involved are doing will post any useful information in re creating these errors as a reference for someone else who might run into this problem.
@rfay Thank you very much for looking at the database I appreciate that you took the time to look into it... I think I need to try and see how we got this error in the first place.
Comment #11
rszrama commentedRe: #10, the errors look related to another issue where someone updated to a new dev but didn't clear the cache before submitting the Add to Cart form. In that case, there would have been missing data from the cached field formatter info array - specifically the line_item_type variable. Did you do something similar? (I've since committed a follow-up patch to mitigate this error, but you should still run update.php when you update between devs in case there were any DB changes or the cache needs clearing.)
Comment #12
jlab commented@rszrama Thank you I found the solution you described on another issue and it resolved my problem in #11.
The issue at #7 did pop up it's head again a bit later I was quite frustrated and almost tore my hair out at a stage luckily I made frequent backups almost every half an hour when the issue from #7 popped up again I built a new sandbox from the backup and started scrutinising the two installs. I finally realised that the error was caused by the client not providing a value for the price field for two of the products.
I tried to solve this from not happening in the future by mistake by making the price field mandatory but I end up with this message being displayed "The field Price is locked and cannot be edited."
Is there maybe a way to set this in the database? Because if the user forgets to add a price for the product I will end up with the error popping up again and being unable to add product displays until I find the products that doesn't have a price value.
Otherwise everything is now working super again...
Comment #13
rszrama commentedAhh, yep, I ran into that same problem when dealing with an import situation for one of our clients. I bet we should probably make that field required and just default it to 0 or something. Will think about that...
Comment #14
rfayInteresting - yeah, over in Commerce Feeds we've been trying to get to the bottom of products imported without price values, which causes havoc - #1183006: Price of zero gets dropped (because if empty() is used).
I do think probably Price itself should force the price if there isn't one.
Comment #15
rfayAnd @personxx, congratulations on your success in getting to the bottom of this. @Ryan, thanks for the word about the cache issue.
Comment #16
Stalski commentedI have the same problem now in line 112 as well, and cache clear does not fix it.
You can reproduce it by submitting the shopping cart block with a add to cart forms in it. (but we don't do that ofcourse)
Comment #17
rfay@Stalski, if you can post an exact description of the error you have and how to recreate it, it will help us. If it makes sense, I may ask you for a database so I can take a look at it.
Comment #18
mmll commentedI had the same problem.
1) Create product without a price.
2) Creating display with product reference field.
3) Add a reference to: New display node
4) You'll go to see the node what was created
And here it is:
EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. funktsioonis EntityMetadataWrapper->set() (rida 112 / /var/www/htdocs/sites/all/modules/entity/includes/entity.wrapper.inc).
You can fix it by going back to your product list and filling up the price field.
Comment #19
rszrama commentedAs described in #1091658-8: Commerce price widget does not respect the 'required' instance setting / product without prices are not expected by the system, with the commit linked below, you should no longer be seeing errors related to products without prices.
Commit: http://drupalcode.org/project/commerce.git/commitdiff/85059fd
Comment #20
rfayExcellent!
Comment #21
marcjohnson commentedApplied rszrama's full patch #19 against 7.x-1.0-rc1.
Can confirm it worked marvelously.
Before patch, a missing price caused site outage with error message above. Now all is well. Thanks.