When I hit add to cart in a view displaying products I get this error:

EntityMetadataWrapperException: Unknown data property commerce_order_total. in EntityStructureWrapper->getPropertyInfo() (line 317 of /srv/www/700/public_html/sites/all/modules/entity/includes/entity.wrapper.inc).

These modules are used
Drupal Commerce 7.x-1.0-beta2
Views 7.x-3.0-beta3 (same error with beta2, beta1, dev)
Rules 7.x-2.0-beta1 (same error with dev)
Address field 7.x-1.x-dev
Ctools 7.x-1.0-alpha4 (same error with dev)
Entity API 7.x-1.0-beta8 (same error with dev)

Any ideas what this could be related to?

Solution

For those with drush, reconfigure your line items like so.

drush en -y commerce_line_item;
drush php-eval "commerce_line_item_configure_line_item_types();";

for those without run this using devel at /devel/php

commerce_line_item_configure_line_item_types();
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pcambra’s picture

I think you still should install all dev versions of the commerce dependent modules by the moment, maybe some of the updates between non-dev and dev of the dependencies are not updating correctly between versions.
Have you tried commerce beta2 with all dependencies in dev from scratch?

rottencheese’s picture

I have the same problem with clean install of commerce dev. version (2011-Apr-06)

EntityMetadataWrapperException: Unknown data property commerce_product. in EntityStructureWrapper->getPropertyInfo() (line 317 of /sites/all/modules/entity/includes/entity.wrapper.inc).

Using Entity:
7.x-1.x-dev tar.gz (69.58 KB) | zip (84.68 KB) 2011-Mar-21

rottencheese’s picture

Here's my screenshot

toby.batch’s picture

I have the same problem. I'm using the dev version of commerce, and I added the dev version of entity api

ananto’s picture

Same problem here. Is there any solution for this ?

rszrama’s picture

Status: Active » Postponed (maintainer needs more info)

Alrighty guys, I believe this has come up before. However, getting +1's without any hint about your configuration isn't very helpful. In order to properly diagnose, we're going to need to know what View you're actually using - as in, create the View, export it, and post the contents here in a code block. I've created various types of Product Views and Node Views with product reference fields in them and have not had any trouble adding products to the cart. This leads me to believe there's something wrong with your View or your general installation.

Also for your reference, you should be installing Drupal Commerce with the dev versions of all dependencies as documented on the project page's installation instructions. Anything else is likely to result in these types of errors, and we aren't supporting fixing those problems. Additionally, prior to the Drupal Commerce beta, we had a documented lack of support for updates from prior versions to the current version from a database / field standpoint. If you're trying to update from earlier versions, you will likely be missing an order total field or some other database columns that will result in these errors. We aren't supporting fixing those problems either.

So what we really need are clear steps to duplicate the bugs you're getting with the current version of Commerce. Then we can apply a fix, and if the fix requires a database or field update from beta3 to be properly applied, we will add it.

sopratricx’s picture

Hi everyone.

This same issue happened to me and unfortunately I have already got so far with my completed site that I can't restart with the commerce dev profile. See the error message below:

EntityMetadataWrapperException: Unknown data property commerce_product. in EntityStructureWrapper->getPropertyInfo() (line 316 of /home/sites/httpd/htdocs/sites/all/modules/entity/includes/entity.wrapper.inc).

Basically I made a list of new products in store section and then created a new 'product page' content type by adding the correct fields for a product reference fields. The error comes when I make a new 'product page ' content as soon as I hit save or view this page.

I tried out switching to all the dev version of modules with no joy and looked again at all the modules and realise they are not all current.

What do you recommend doing at this point? should I remove all associated modules manually & reinstall all dev version as well as remove associated tables from the database?

or can I just download fresh versions and run updates?

Do i need to remove the specific content types which are associated with the commerce fields?

Modules I am using: Commerce 7.x-1.x-dev, Chaos tools 7.x-1.0-alpha4, Commerce PayPal 7.x-1.x-dev, Address Field 7.x-1.0-alpha2, Rules 7.x-2.x-dev, Views 7.x-3.x-dev, Entity API 7.x-1.0-beta8

Sorry for all the questions - I've spent a lot of time on it trying to work out a solution and quite stuck.

Thanks.

Rich

rfay’s picture

I can take a look at a database if necessary. Please dropbox or email me a database that demonstrates this. randy at randyfay dot com. I don't like the number of people this seems to be affecting.

I'm unable to recreate this with a fresh install of Drupal Commerce using the Commerce Kickstart install profile.

sopratricx’s picture

Hi Randy,

Thanks. I will email you the database now.

cheers.

Rich

rfay’s picture

Title: Cannot add product to cart » Unknown data property commerce_product. in EntityStructureWrapper->getPropertyInfo()
Status: Postponed (maintainer needs more info) » Active

OK, thanks sopratricx. I spent a lot of time looking at this and don't have an answer yet, but it seems to be a real problem, and may be an ugly one in the entity world.

First of all, the problem described in the original report is completely different from the one in #2 and #7. The error looks the same until you see that this one is about 'commerce_product'. I'm changing the name to reflect the problem in #2 and #7, as nobody has reported the original again. @pontus_nilsson, if you do still see what you originally reported, please speak up and we'll split this issue in two.

What's going on here is that the commerce_line_item type is created from scratch all the time in order to present pricing information. Every time we need to display a price, a commerce_line_item is created from nothing. And that is a lot. Well *sometimes* that line item entity does not have in its properties array a 'commerce_product'. And the entity module's property-getter is quite brittle and throws an exception if you don't have a property you're trying to get.

I'm not a real expert on entities, but it seems that we are occasionally getting commerce line items that do not have a product field (product property), and that's what causes this #fail.

I think I've run out of time for today, but thanks for sending the db along, and hopefully I'll be able to spend some more time with it. It does not appear to me that this is a failure of upgrading or anything like that.

rfay’s picture

Status: Active » Needs review
FileSize
2.63 KB

OK, well I couldn't keep my hands off it.

Here's a patch that fixes most of this problem. But there still remains a

Cannot access protected property EntityValueWrapper::$data in /home/rfay/workspace/commerce/sites/all/modules/commerce/modules/product_reference/commerce_product_reference.module on line 853

which is a result of the current code not handling the assignment to ->data correctly. I tried several workarounds but don't know enough about the relationship between the entity wrapper and the line item to get it right. If I'm not mistaken, changes to the entity wrapper aren't happening in the $line_item anyway, and therefore are of no value. But again, this is all pretty new to me.

I put this in "needs review" but it's certainly not actually ready for review, as it still contains a fatal. But it seems to me that adding to the hook_entity_property_info() with the things we're trying to access is required, and you definitely can't assign "" to commerce_display_path, as it's the wrong type (only arrays and objects are allowed). So does that mean this code path has never been executed before? I'm a bit baffled.

sopratricx’s picture

Hi rfay,

Thanks for looking into it. To be honest I am trying to follow it and think I'm there but also not on a level close to debugging the error so hopefully someone else can give it a try. But anything I can do to help let me know.

Something to note is that after a while it throws up another error message below and adds the header again to
the bottom of the page. When I disable the commerce modules this also goes.

Warning: Cannot modify header information - headers already sent by (output started at /home/sites/sopratricx/httpd/htdocs/includes/common.inc:2561) in drupal_send_headers() (line 1040 of /home/sites/sopratricx/httpd/htdocs/includes/bootstrap.inc).

EntityMetadataWrapperException: Unknown data property commerce_product. in EntityStructureWrapper->getPropertyInfo() (line 316 of /home/sites/sopratricx/httpd/htdocs/sites/all/modules/entity/includes/entity.wrapper.inc).

Best.

Rich

Damien Tournoud’s picture

My feeling is that using the EntityMetadataWrapper is doing more harm then good to us. We could consider just ditching that and accessing field data structures the way they are supposed to be accessed.

rszrama’s picture

Status: Needs review » Needs work

I'm actually closer to thinking this is an installation issue. If the entity metadata wrapper doesn't have access to the commerce_product field property, then it likely doesn't exist... which means something could have failed on the product line item type configuration (so we'd have a problem using the wrapper or direct access). Not entirely sure... I still haven't been able to replicate the broken scenario.

Regarding your fix, Randy, we don't really want to directly declare field properties via hook_property_info() unless we can be sure the field will exist on every instance of the entity. So default fields that we know will be on every line item type are fine (so unit price should be fine to pre-declare), but the commerce_product product reference wouldn't be since it's only going to be present on product line items.

aristeides’s picture

FileSize
292.32 KB

I've got exactly the same problem.

I'm attaching the exported database (used phpMyAdmin to export) for anyone unable to reproduce the error.

rfay’s picture

Hi Ryan - I look forward to strategizing more with you on this.

This is a line item being created "from nothing" for display purposes. It doesn't have the commerce_product or the commerce_display_path. However, with the patch here, if I just arbitrarily set the price, I get proper display.

Since reporters have provided databases, it's pretty easy to study this one, so we ought to be able to nail it.

I do suspect that EntityMetadataWrapper may be too brittle, as DamZ points out, and we might want to move away from it. We have seen too many of these crop up, and they require serious debugging to sort out what's going on with them.

rfay’s picture

@aristeides, your problem is completely different. You get

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).

on adding a product to the cart.

Followups on aristeides problem go into #1151614: "EntityMetadataWrapperException: Invalid data value given" when adding product to cart

rfay’s picture

@sopratricx, it appears that the core of what's happened in your database is that it didn't get installed correctly. There are several missing fields on the line item.

Could you tell us a little bit about how you installed it and when (what version of Commerce did you start with? Did you install with drush? Have you upgraded? More than once?)

Edit: It's impossible to manually add the missing fields using the UI, because the UI forces the name to be field_commerce_unit_price, for example, instead of commerce_unit_price.

sopratricx’s picture

Thanks rfay.

Ok that would make some sense. To be honest not sure which version of commerce i started with - i think it was the beta 2 version - in April. I didn't install with drush and yes probably upgraded it 1 or 2 times in an attempt to troubleshoot. I do seem to remember that when I first enabled the modules the commerce product view didn't have a 'price' field or 'basic price' field as seen in the copenhagen drupal demo video. I just assumed that this was to do with the 'commerce dev' profile.

What do you suggest now in terms of reinstating this - reinstalling etc? i'm very keen to use the commerce module as it seems great? also would like to figure out the drush method too as it seems essential. I'm on a Mac and haven't used terminal to connect to a server before.

Any suggestions would be great.

Thanks.

Rich

angelbreath’s picture

I have exactly the same problem as described.

EntityMetadataWrapperException: Unknown data property commerce_product. στην EntityStructureWrapper->getPropertyInfo() (line 317 του .../drupal/sites/all/modules/entity/includes/entity.wrapper.inc).

I tried re-install didnt solved the problem. I use 7.x-1.0-beta3 of commerce and all required modules are up to date.

rfay’s picture

@sopratricx, you don't have much investment in products or setup or anything. You could start the whole site over again.

Unfortunately, I'm not sure you'll be able to uninstall the commerce suite and start over - see #858722-62: Cannot reinstall Commerce modules after uninstall due to field deletion failure.

@ryan, can you recommend a way to recreate the missing fields? We don't have a UI for that. Since they're not provided by the field module, they're not named 'field_' whatever, so we don't have a way to recreate them..

sopratricx’s picture

Thanks again. Sounds like the only solution really.

@ryan, it would be a real help if you could recommend the best solution.

Best.

Rich

rfay’s picture

@sopratricx, an uninstall script that should work for your database (I tried it) is at #858722-82: Cannot reinstall Commerce modules after uninstall due to field deletion failure

googletorp’s picture

Status: Needs work » Postponed (maintainer needs more info)

I hope you don't mind me butting in here. I have spend a lot of time debugging entity errors and have munching around in the field config table when I needed to upgrade the site I launched on commerce alpha.

Anyways I'm supporting Ryan in that this issue is an misconfiguration error rather than an error with the commerce code. I took the database posted in #15, after messing looking around a bit, I found the error to be the data stored in the field_config table. The product reference field, that is installed on the product line item was deactivated (active = 0). The field itself was also locked, so I'm not sure how this happened. By changing the value of active to 1 and clearing cache the error disappeared. I imagine that the issue is the same for the other cases.

I'll be happy to take a look at any database, but it should be easy for you to check the value of the field_config table. You need to check the values for the field named commerce_product. You could also just post a SELECT * FROM field_config;

rfay’s picture

@googletorp, thanks for your help here. My opinion is that we have to make these more debuggable (and more rare). I'm working on a possible core patch that would handle exceptions more gracefully (with more information in the log). I think that Entity module might be able to do a lot better too, as DBTNG does a pretty good job of saying where and why the actual problem occurred.

I'm going to say this one is almost a won't fix. However, either this or something similar has happened to multiple people, so there may be a path that causes this #fail, and we need to nail that. Essentially what we had was an install failure, and missing fields.

Here's my opinion about paths forward:

1. Make clear to people that you have to start over if you have an install failure (enabling modules you get any failure).
2. Handle install failures better? Prevent them? I got several when working on #858722: Cannot reinstall Commerce modules after uninstall due to field deletion failure - they're easy to recreate if you try to enable a lot of modules at one time, especially if you have the default 30 second PHP max_execution_time.
3. Handle Entity exceptions better. It seems that Entity module is pretty happy to punt and throw an exception; and the information coming from there is pretty useless. With at least a backtrace, we could make some guesses.
4. Drupal core should probably do better and provide a backtrace. I'm working on that patch now, but the way things are I'm not hopeful that we can get this in in a reasonable timeframe.
5. Figure out what actual failure causes the situation here (missing fields, in this case).

rfay’s picture

I proposed a Drupal exception backtrace log in #1157850: Provide detailed backtrace in the log for Drupal fatal errors.

jkopel’s picture

We are experiencing what I believe to be the same issue.

We installed the dev branch of commerce and all dependencies.
When enabling Product Reference we encountered this issue: http://drupal.org/node/1153484
We disabled/renabled Product Reference and got another (this time fatal) error, but emptied cache and blindly pushed on anyway.

We created some product types, and products and tried to test by manually creating an order. The first time we tried this we got the following:

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /system/ajax
StatusText: Service unavailable (with message)
ResponseText: EntityMetadataWrapperException: Unknown data property commerce_product. in EntityStructureWrapper->getPropertyInfo() (line 319 of /home/clients/websites/{redacted}/public_html/{redacted}/sites/all/modules/entity/includes/entity.wrapper.inc).

The SECOND time our custom product type had vanished!
However the actual products are still there.
The Ajax error is the same, and we are unable to add the product line items to the order.

We are about to restore from a pre-commerce backup and try again. Starting from a fresh DB is just not an option as we have many weeks of work into other areas of site development.

I will report back with any new observations, and I am happy to post this DB (or perhaps just pertinent tables) if it will help.

rszrama’s picture

It might also be helpful to use this new module (has a dependency on Devel) rfay just posted to help trace these errors... http://drupal.org/project/commerce_devel

jkopel’s picture

Thanks Ryan, we installed it.
Of course now that we installed from our backup DB the error has gone away, so...

rszrama’s picture

Oh, it would also be helpful to know if you're using any contributed modules integrating with Drupal Commerce. Someone else getting the errors traced them back to the Commerce Delivery module.

helios1877’s picture

Version: 7.x-1.0-beta2 » 7.x-1.0-beta3
FileSize
408.52 KB

I'm going to have to +1 this for beta3 as well. I wish I could be more proactive on debugging the issue on my own, but I'm pretty new to PHP and the code is way over my head. I also had the other error which occurred on line 101, which I was able to fix based on the above suggestion that the commerce_line_item property was locked in the field_config table, but I still receive the "Unknown data property commerce_product. in EntityStructureWrapper->getPropertyInfo()" error which occurs on line 317 of entity.wrapper.inc on my system. I have tried uninstalling and reinstalling Drupal and doing a clean install of all of the modules as well as Drupal Commerce, but it did not solve the issue. Unfortunately I cannot provide any more information on the subject, however, I will attach my database just in case it might help anyone in solving the issue

rfay’s picture

@helios1877, what we've learned in this issue so far, to the best of our knowledge, is that you had an install failure and the commerce_product product reference didn't get added to your line item (if I remember right). Today, that means that you need to uninstall and reinstall. We'll be working on a tool that can clean it up. If you install http://drupal.org/project/commerce_devel and get the stack trace from this error, I think we'll find that's the case.

jkopel’s picture

Sorry to have not replied earlier.
We are still testing against a "vanilla" install and are not using any contrib (yet).

That said, I think the error was introduced when we
1. installed everything (and particularly) product reference
2. got an error on install for product reference
3. turned product reference off (did NOT uninstall it though)
4. turned it back on

Beyond that I am afraid I don't have any useful info, since we are no longer getting the error.

rfay’s picture

Status: Postponed (maintainer needs more info) » Active

@jkopel, that's exactly what my theory would have been. The one missing piece: What *was* the error that caused the failure.

I'm experimenting with a rebuild technique for line item fields.

rfay’s picture

Status: Active » Needs review
FileSize
3.51 KB
10.6 KB

The underlying problem in all these cases is that some kind of error happens in the install/enable process, and there's no way to rebuild the missing fields that result from that.

This experimental patch provides "rebuild" options as tabs for line item, product, customer profile, and order.

Rebuilding line items and products fixes the database provided by helios1877 in #31.

I wouldn't be surprised if Ryan will want a different user interface for this, but this approach, suggested by him in #1173208: Add a default field integrity checker is, I think, fundamentally sound except for the fact that we don't know what causes the install failures in the first place.

I just realized that another sound approach to this would be to replicate the hook_modules_enabled() functionality in hook_enable(). Then you'd just have to disable and re-enable the module and it would come out OK.

rfay_dell_gazelle_Selection_015.png

rszrama’s picture

Status: Needs review » Needs work
Issue tags: +dcsprint6, +rcblocker

Will run over this problem and the UI with Bojhan tomorrow. I'm pretty sure we won't want this promoted as a tab on the Products page, especially since in the best case it won't be necessary and in the worst case should only have to be used once. The gist of the fix itself is looking good, though.

(Tagged for the sprint / RC blocker.)

JohnDoranNY’s picture

rfray,

I used your patch adn I rebuilt for all but line orders which throws the error:

Fatal error: Unsupported operand types in /home/content/21/7420121/html/americadirectbook/modules/field/field.crud.inc on line 597

•Notice: Undefined index: weight in field_info_max_weight() (line 802 of /home/content/21/7420121/html/commercedevsite/modules/field/field.info.inc). Backtrace:
field_info_max_weight('commerce_line_item', 'bundle', 'display') field.crud.inc:605
_field_write_instance(Array) field.crud.inc:491
field_create_instance(Array) commerce_product_bundle.module:1174
commerce_product_bundle_configure_line_item() commerce_line_item.module:504
commerce_line_item_configure_line_item_type(Array) commerce_line_item.module:226
commerce_line_item_configure_line_item_types() commerce_line_item.module:261
commerce_line_item_repair_line_item_fields()
call_user_func_array('commerce_line_item_repair_line_item_fields', Array) menu.inc:501
menu_execute_active_handler() index.php:22

•Notice: Undefined index: weight in field_info_max_weight() (line 802 of /home/content/21/7420121/html/commercedevsite/modules/field/field.info.inc). Backtrace:
field_info_max_weight('commerce_line_item', 'bundle', 'display') field.crud.inc:605
_field_write_instance(Array) field.crud.inc:491
field_create_instance(Array) commerce_product_bundle.module:1174
commerce_product_bundle_configure_line_item() commerce_line_item.module:504
commerce_line_item_configure_line_item_type(Array) commerce_line_item.module:226
commerce_line_item_configure_line_item_types() commerce_line_item.module:261
commerce_line_item_repair_line_item_fields()
call_user_func_array('commerce_line_item_repair_line_item_fields', Array) menu.inc:501
menu_execute_active_handler() index.php:22

rfay’s picture

@JohnDoranNY, The complaint about 'weight' is fixed in current versions of commerce and drupal (you need both). Are you using the latest commerce and drupal core?

glennpratt’s picture

Assigned: Unassigned » glennpratt

I'm finishing this one up from the sprint, marking to avoid duplication of effort.

rszrama’s picture

How'd it go, Glenn? : )

glennpratt’s picture

Here's what I have. It needs to be re-rolled to the latest code, but I haven't taken the time to resolve conflicts yet.

glennpratt’s picture

Hrmm, empty patch...

angelbreath’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta3

After having this problem as i mention in a previous post, i installed the new version (beta-4) and now a Fatal Error

Fatal error: Call to undefined function entity_rules_events_variables() in /home/*****/public_html/personal/drupal/sites/all/modules/commerce/modules/payment/commerce_payment.rules.inc on line 23

Actually now, nothing works in my website. I cant even disable or enable modules, i lost even the administration menu.

rszrama’s picture

Do you have the latest versions of your dependencies? Did you run update.php after updating to beta4? One of those two things is likely your problem.

glennpratt’s picture

Here's a reroll. I'm using the list of fields that mikejoconnor sent, but it needs review because some of the fields aren't there.

To be clear, what we've done is add a list of default commerce field to hook_entity_info:

/**
 * Implements hook_entity_info().
 */
function commerce_product_entity_info() {
  $return = array(
    'commerce_product' => array(
      'label' => t('Commerce Product'),
      // snip...
      'commerce default fields' => array(
        'commerce_price' => 'commerce_product_configure_product_types',
      ),
      // snip...
    ),
  );
  // snip...
}
glennpratt’s picture

Whoops, rebase added some old context back in.

glennpratt’s picture

JohnDoranNY’s picture

rfay,

Thanks.. I just updated everything today including to beta 4 of drupal commerce (and having a bunch of other problems now).... with the update to the new beta 4 I no longer have your patch installed (does it with with beta 4? is it necessary in beta 4?)

JohnDoranNY’s picture

glennpratt,

Is this patch needed in Beta 4?

angelbreath’s picture

Maybe a noob question, but how i apply the patch?

silkogelman’s picture

the issue mentioned by angelbreath about beta4 is here:
#1186118: Call to undefined function entity_rules_events_variables() in commerce_payment.rules.inc on line 23

@ angelbreath: patching docs are here:
http://drupal.org/node/707484

vasi1186’s picture

Hi,

I also have this issue. I basically installed the commerce modules and their dependencies on an drupal 7.2 instance (upgraded from 7.0 and run all database updates). I just tried to enable all the commerce modules, and received this error. The drupal instance contains almost no additional modules, and no commerce contributed module.

Vasi.

glennpratt’s picture

Version: 7.x-1.0-beta3 » 7.x-1.x-dev

To clarify, this patch attempts to find missing entity fields that Commerce provides and a way to restore them. I don't believe it fixes anything automatically.

This patch is rolled against the dev, not sure it will apply to beta4.

Right now we need to nail down the list of "commerce default fields" in the various hook_entity_info()s and make sure they are correct.

nagiek’s picture

+1 subscribe. same 317 error on a fresh install.

Thanks for looking into this!

rszrama’s picture

Version: 7.x-1.0-beta3 » 7.x-1.x-dev
Issue tags: -rcblocker

Just noting that I'm removing RC blocker status due to time constraints, my inability to get the patch to apply (I tried various methods), and the fact that I'd be happy to commit this feature at any time. In any event, I looked over the code, and I do like the idea of registering default required fields in the entity info array. We're trying to get the RC out tomorrow or Tuesday, and if I can retool the patch for the current codebase before we go live, I will. Otherwise, if anyone else can get a reroll to work, I'd appreciate it. : )

AdamGerthel’s picture

What is the status on this? I've read through the issue, but It's still a bit vague.

Im running:
Drupal 7.2
Commerce beta 4
Commerce stock 7.x-1.0-alpha2
CTools 7.x-1.0-beta1
Entity API 7.x-1.0-beta9
Rules 7.x-2.0-beta2
Views 7.x-3.x-dev (2011-06-23)

I'm not sure when this started. It has been working before, and I think it started after upgrading from Commerce beta 3 to beta 4 but i'm not certain.

glennpratt’s picture

Here is a re-roll, git rebase only had one minor conflict. Still has some missing fields. Untested.

rfay’s picture

Status: Needs work » Needs review

Changing to CNR

AdamGerthel’s picture

I haven't managed to patch Beta 4 with the patch from #57. I'm new to git apply -v , but I do think I did it right. Didn't get any error messages. It's just that nothing happened at all.

If it's any help, this is my full error (after installing Devel Commerce) when trying to add a product to the cart:

ntityMetadataWrapperException: Unknown data property . in EntityStructureWrapper->getPropertyInfo() (line 319 of /hidden/sites/all/modules/contrib/entity/includes/entity.wrapper.inc). Backtrace:
EntityStructureWrapper->getPropertyInfo('') entity.wrapper.inc:376
EntityStructureWrapper->get('') entity.wrapper.inc:396
EntityStructureWrapper->__get('') commerce_delivery.rules.inc:177
commerce_delivery_item_is_shippable(Object, Array, Object, Object, 'execute') 
call_user_func_array('commerce_delivery_item_is_shippable', Array) faces.inc:123
FacesExtendable->__call('execute', Array) rules.core.inc:149
RulesExtendable->__call('execute', Array) rules.plugins.inc:91
RulesCondition->executeCallback(Array, Object) rules.core.inc:1256
RulesAbstractPlugin->evaluate(Object) rules.plugins.inc:458
RulesAnd->evaluate(Object) rules.plugins.inc:209
Rule->evaluate(Object) rules.plugins.inc:379
RulesReactionRule->evaluate(Object) rules.core.inc:1879
RulesActionContainer->evaluate(Object) rules.plugins.inc:669
RulesEventSet->executeByArgs(Array) rules.module:804
rules_invoke_event_by_args('commerce_line_item_insert', Array) rules.module:749
rules_invoke_all('commerce_line_item_insert', Object) commerce.controller.inc:26
DrupalCommerceEntityController->invoke('insert', Object) commerce.controller.inc:136
DrupalCommerceEntityController->save(Object, Object) commerce_line_item.controller.inc:82
CommerceLineItemEntityController->save(Object) commerce_line_item.module:546
commerce_line_item_save(Object) commerce_cart.module:902
commerce_cart_product_add('1', '2', '1', Array) commerce_cart.module:1586
commerce_cart_add_to_cart_form_submit(Array, Array) form.inc:1409
form_execute_handlers('submit', Array, Array) form.inc:831
drupal_process_form('commerce_cart_add_to_cart_form_2_3_4_6', Array, Array) form.inc:351
drupal_build_form('commerce_cart_add_to_cart_form_2_3_4_6', Array) form.inc:189
drupal_get_form('commerce_cart_add_to_cart_form_2_3_4_6', Array, 0, '1', Array, Array) commerce_cart.module:1746
commerce_cart_field_attach_view_alter(Array, Array, NULL) module.inc:1004
drupal_alter('field_attach_view', Array, Array) field.attach.inc:1185
field_attach_view('node', Object, 'full', 'en') node.module:1362
node_build_content(Object, 'full', 'en') node.module:1286
node_view(Object, 'full', NULL) node.module:2521
node_view_multiple(Array, 'full') node.module:1411
node_show(Object) node.module:2592
node_page_view(Object) 
call_user_func_array('node_page_view', Array) menu.inc:503
menu_execute_active_handler() index.php:21
AdamGerthel’s picture

Update:

This is very odd. After leaving the site for a short break, I came back and tried adding a product to the cart (same product as before). And it worked. I can't think if any changes at all that I did. I tried adding another item, and the error came back. I emptied the cart, and added the first product (that worked) again, and the error came back. I didn't touch any settings and didn't flush cache.

jcodina’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta4
Assigned: glennpratt » Unassigned

I have a similar error:

EntityStructureWrapper->getPropertyInfo('commerce_order_total') entity.wrapper.inc:376
EntityStructureWrapper->get('commerce_order_total') entity.wrapper.inc:396
EntityStructureWrapper->__get('commerce_order_total') commerce_order.controller.inc:83
CommerceOrderEntityController->save(Object) commerce_order.module:343
commerce_order_save(Object) commerce_cart.module:565
commerce_cart_order_new('1') commerce_cart.module:866
commerce_cart_product_add('1', 1, 1, Array) commerce_cart.module:1586
commerce_cart_add_to_cart_form_submit(Array, Array) form.inc:1409
form_execute_handlers('submit', Array, Array) form.inc:831
drupal_process_form('commerce_cart_add_to_cart_form_1', Array, Array) form.inc:351
drupal_build_form('commerce_cart_add_to_cart_form_1', Array) form.inc:189
drupal_get_form('commerce_cart_add_to_cart_form_1', Array, , 1, Array, Array) commerce_cart.module:1746
commerce_cart_field_attach_view_alter(Array, Array, NULL) module.inc:1004
drupal_alter('field_attach_view', Array, Array) field.attach.inc:1185
field_attach_view('node', Object, 'full', 'ca') node.module:1362
node_build_content(Object, 'full', 'ca') node.module:1286
node_view(Object, 'full', NULL) node.module:2521
node_view_multiple(Array, 'full') node.module:1411
node_show(Object) node.module:2592
node_page_view(Object) 
call_user_func_array('node_page_view', Array) menu.inc:503
menu_execute_active_handler() index.php:21
rszrama’s picture

Version: 7.x-1.0-beta4 » 7.x-1.x-dev
Assigned: Unassigned » glennpratt

Does the product you're trying to add have a price? If not, it needs one.

AdamGerthel’s picture

@#62 Yes. The products have prices, and VAT tax.

rszrama’s picture

Ahh, I see the error was generated by commerce_delivery... someone else has been reporting issues with that module, so it could be some kinda bug in there.

AdamGerthel’s picture

I'll turn off commerce_delivery and do some more testing.

sonar_un’s picture

Subscribing

rfay’s picture

Status: Needs review » Needs work

#57 doesn't apply. Sorry. I was hoping to use this to repair my database from #1231112: EntityMetadataWrapperException: Unknown data property commerce_price

$ git apply *.patch
error: patch failed: modules/customer/commerce_customer.module:49
error: modules/customer/commerce_customer.module: patch does not apply
error: patch failed: modules/line_item/commerce_line_item.module:35
error: modules/line_item/commerce_line_item.module: patch does not apply
error: patch failed: modules/order/commerce_order.module:50
error: modules/order/commerce_order.module: patch does not apply
error: patch failed: modules/product/commerce_product.module:100
error: modules/product/commerce_product.module: patch does not apply
Russell Mann’s picture

+1
OpenPublic + DrupalCommerce... with Entity wiped and reinstalled because the OP shipped Entity has issues.

charlessmith’s picture

FileSize
539.24 KB

I have the same problem keep getting error either when adding a product or trying to view it...

Error
The website encountered an unexpected error. Please try again later.
Error message
EntityMetadataWrapperException: Unknown data property commerce_product. in EntityStructureWrapper->getPropertyInfo() (line 328 of C:\wamp\www\dronecheck\sites\all\modules\entity\includes\entity.wrapper.inc).

Attached is my database and I am using Drupal core 7.7, Entity 7.x-1.0-Beta4, Commerce 7.x.1.0 Rc1. I have uninstalled Commerce and Commerce Paypal, reinstalled them with the latest versions (which were incidentally the same versions I had originally installed as I only got it up and running recently) Any help for a newbie to Drupal would be greatly appreciated as at the moment I can not get the commerce aspects running. If I patch those files with the above patch (which to be honest I am not versed in by any stretch as a new user to this system) will it fix this problem or do I need to start everything from scratch again including the database?

Thanks in advance,

Chaz

silkogelman’s picture

@charlessmith
try using Rc2, it got released today.

Also, always test if the error persists with the latest dev version.
The dev version may have certain problems fixed that you are experiencing with 'Reccomended releases'.

Hope that helps.

charlessmith’s picture

Thank you, I will get on that later. Do you suggest with this issue I take RC1 off completely then put on RC 2 rather than upgrade?

Thanks again,

Chaz

rszrama’s picture

You can just copy it over the same directory, as no files were removed (or added) in the commits from RC1 to RC2.

charlessmith’s picture

Hi,

I have updated to the latest versions of Commerce, no luck, still the same errors. I have done a fresh install (actually two for some reason the first one I could not see all the menu items under store, tried everything with no success), and I still get these kind of errors whenever I do anything with the product (this one is from creating a piece of content that had the test product as a line item) :

EntityMetadataWrapperException: Unknown data property commerce_product. in EntityStructureWrapper->getPropertyInfo() (line 328 of C:\wamp\www\drupal_dronecheck\sites\all\modules\entity\includes\entity.wrapper.inc).

When manually creating an order when I select the product item I managed to create it comes up with error:

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /drupal_dronecheck/system/ajax
StatusText: Service unavailable (with message)
ResponseText: EntityMetadataWrapperException: Unknown data property commerce_product. in EntityStructureWrapper->getPropertyInfo() (line 328 of C:\wamp\www\drupal_dronecheck\sites\all\modules\entity\includes\entity.wrapper.inc).

I have attached the new database. I will be honest I have no idea what to do with this now, I am a relative newbie to Drupal and PHP so really not sure how to fix all these errors so again any help would be amazing :-)

Thanks,

Chaz

rfay’s picture

@charlessmith, are you saying you did a fresh install (using commerce_kickstart?) and you got errors out of the starting gate? Is this database dump from a fresh install?

silkogelman’s picture

@charlessmith try using the latest Entity API.
Beta4 is outdated (current = beta10).
I think that will solve the problem for you.

use at least these versions: (as recommended on the Commerce project page)
Ctools 1.0-rc1
Views 3.0-rc1
Entity API 1.0-beta10
Rules 2.0-beta3
Address field 1.0-beta1

and if the problem persists, try dev versions.

charlessmith’s picture

Hi,

I did not use Commerce_kickstart last time but I have used it again and appears to be working now.

Thanks for the help! :-)

Chaz

greysun’s picture

Warning: Cannot modify header information - headers already sent by (output started at /mnt/webc/42/58/51167658/htdocs/d/includes/common.inc:2567) in drupal_send_headers() (Zeile 1018 von /mnt/webc/42/58/51167658/htdocs/d/includes/bootstrap.inc).
EntityMetadataWrapperException: Unknown data property commerce_product. in EntityStructureWrapper->getPropertyInfo() (Zeile 328 von /mnt/webc/42/58/51167658/htdocs/d/sites/all/modules/entity/includes/entity.wrapper.inc).

Getting these errors everywhere!
Drupal Commerce RC3, latest stable contrib modules...

Any working hint?
Re-Install is no solution...

rfay’s picture

@greysun - the Cannot modify header information - headers already sent seems to imply you might have something else going on.

If I were you I'd try dev of everything; make sure to clear caches. Make sure you don't have a node pointing to a non-existent product, which is a very common way to get this.

greysun’s picture

You are right. If I delete my display node, all errors are gone, so I think there isn't anything else going on.

I have 2 products, 1 product type and I created 1 product display type.
If I create a product display node and add these 2 products to it, those errors will appear.
But my products exist!
What is going wrong?

rfay’s picture

@greysun, Is this a commerce kickstart installation or a custom one?

Seems like you have a damaged install or something.

davident’s picture

I'm also getting this error when viewing any product display with referenced products. Latest build of everything and all modules are enabled.
I also get a 500 ajax error when making an order manually after selecting a product from the line-item drop-down menu.
However, there is no error if just the teaser of the product display is viewed.

EntityMetadataWrapperException: Unknown data property commerce_product. in EntityStructureWrapper->getPropertyInfo() (line 328 of /home/accounts/jvclothi/public_html/sites/all/modules/entity/includes/entity.wrapper.inc).

It's worth noting that editing and viewing products in the admin overlay works fine.

rfay’s picture

@davident are you talking about two separate problems? If you have an additional problem, please open a new issue.

greysun’s picture

It's a custom one.

greysun’s picture

Any idea how to fix this?

rfay’s picture

@greysun, if you've already done all in your power, have disabled any custom code and any commerce contrib modules, are at the current dev of drupal and all modules, have run update.php, and are sure you've configured things as well as you can, I'm willing to look at a database. You can send me a dump or a link link to your db dump at randy at randyfay dot com. Or if it's generic enough to post, you can attach the dump to this issue.

greysun’s picture

Updated to Commerce 1.0!

If I choose one or more product(s) to be displayed on my product display node, I'm still getting the same error:
EntityMetadataWrapperException: Unknown data property commerce_product. in EntityStructureWrapper->getPropertyInfo() (Zeile 328 von /mnt/webc/42/58/51167658/htdocs/d/sites/all/modules/entity/includes/entity.wrapper.inc).
If I choose "none" everything is OK.

At least the "modify-header"-error disappeared...

---

I use the latest stable modules, not dev...I'm going to disable all contrib modules, recreate my products and my product display node/content type.
@rfay If this won't solve that problem, I will contact you via email.

PS: Is that bug fixed, so it's possible to reinstall the whole commerce module?

---

Edit: I cannot delete any product, getting the error from above!

googletorp’s picture

I am seeing the same problem in Commerce Shipping #1151624: EntityMetadataWrapperException : Unknown data property shipping_method

I believe the problem as least in Commerce Shipping is related to

commerce_shipping_configure_line_item not being executed properly via hook_commerce_line_item_info. Since the functionality is pretty much the same for product line items this might give a hint as to what is wrong. I haven't read all the comments so sorry if this is duplicate info.

Balbo’s picture

I "lost" my commerce_customer_billing field in admin/commerce/config/order/fields. Trying to use the patch in #35 (with git apply -v commerce.field_repair_options.patch) I received this error:

Checking patch modules/customer/commerce_customer.module...
Checking patch modules/customer/commerce_customer_ui.module...
Checking patch modules/line_item/commerce_line_item.module...
Checking patch modules/line_item/commerce_line_item_ui.module...
Checking patch modules/order/commerce_order.module...
error: while searching for:
 }
}

/**
* Implements hook_modules_disabled().
*/

error: patch failed: modules/order/commerce_order.module:136
error: modules/order/commerce_order.module: patch does not apply
Checking patch modules/order/commerce_order_ui.module...
Checking patch modules/product/commerce_product.module...
Checking patch modules/product/commerce_product_ui.module...

I'm using RC1 (and update process is not possible right now).
I used googletorp guide to get somehow the commerce module from alpha to RC1.

Was the patch expected to work (even with RC1)?
If it isn't the case, is there another way to check for field integrity or recreate missing fields (without loosing all the product inserted)?
(Or where to look to recreate the commerce_customer_billing and all eventual dependencies?)

Thanks

rfay’s picture

#35 hasn't applied for awhile I don't think. Probably I should just create an external module that would provide this functionality. #57 is also sadly out of date.

mr.baileys’s picture

We ran into this bug earlier today while upgrading some custom code (unrelated to Commerce, which is at 1.0) -- the site suddenly stopped working, throwing the EntityMetadataWrapper-exception:

"ENTITYMETADATAWRAPPEREXCEPTION: UNKNOWN DATA PROPERTY COMMERCE_PRODUCT. IN ENTITYSTRUCTUREWRAPPER->GETPROPERTYINFO() (LINE 328OF /VAR/WWW/SITE1.TLD/SITE1.TLD/WWWROOT/PROFILES/COMMERCE_KICKSTART/MODULES/ENTITY/INCLUDES/ENTITY.WRAPPER.INC"
(apologies for the caps, the site's styling is all-caps on messages :s)

The stacktrace pointed towards commerce_product_line_item_new and commerce_product_line_item_populate as the culprits, but once I started following the stack trace, I noticed something odd:

module_implements('entity_property_info', TRUE);

returned an empty array.

When I ran

$hook_info = module_hook_info();

... the information for "entity_hook_info" was missing from the results (actually, I got about 44 results, while the same site with the same codebase on another server returned +100 results, including entity_hook_info). Since entity_hook_info directs Drupal to load entity_property_info implementations from *.info.inc files, missing it would explain why there were seemingly no modules implementing hook_entity_property_info, in turn tripping up entity_metadata_load().

Playing around with it some more, I noticed that I got different results from module_hook_info() when using "drush cc all" (after which I'd get 44 results) and manually clearing it via DELETE FROM cache_bootstrap WHERE cid = 'hook_info'; (after which module_hook_info() would return 111 results). In the end I was able to track this down a couple of PHP call-by-reference bugs, which seemed to trip up module_hook_info() in some scenarios, causing the entity_property_hooks to not be invoked. Apparently, module_hook_info() reacted differently to the errors depending on whether it ran in CLI or not.

TL;DR: Sometimes module_hook_info() returns incomplete information (caused by a hidden or seemingly unrelated error), essentially disabling the entity_property_info hooks. When you run into this issue, make sure running module_implements('entity_property_info', TRUE) through devel/php does not return an empty array. In our case, fixing what we thought was an unrelated PHP 5.3 call-by-reference notice fixed the error.

rfay’s picture

@mr.baileys, wow, thanks for that excellent analysis. Is there/should there be a core bug (or entity bug) open for that?

rfay’s picture

@Balbo, @all, here's a reroll of #35 . It's not really a candidate for resolving this issue (see following comments) but it might solve your problem anyway.

rfay’s picture

And here is a reroll of @glennpratt's #57 . I'm not sure it's a candidate either. It also is likely to solve the problem.

rfay’s picture

Doggone it. It needs the file attached! Here's a reroll of @glennpratt's #57

rfay’s picture

OK, I've created the new module Commerce Repair and it depends on the patch in #1273752: Refactor field and type creation out of hook_enable(). People stumbling on issues like this may want to try those out.

brunorios1’s picture

sub

Balbo’s picture

Great, thanks rfay. I'll try those patches out asap.

simonsparks’s picture

Hi,

I have just come across this problem (or something similar) on a new D7 install with the latest commerce modules. I have applied the patch mentioned above and installed the commerce_repair module from git but I am still getting errors.

I have about 10 new product types and the first type has 12 products (variations). I tried to create a single product display (content) that references the 12 product variations but at the time of saving I get:

EntityMetadataWrapperException: Unknown data property commerce_product. in EntityStructureWrapper->getPropertyInfo() (line 328 of /var/www/drupal-7.8/sites/all/modules/entity/includes/entity.wrapper.inc).

Then, after adding the patch and repair module, I tried creating a new product type with a new product and then a new product display; I got the same error when trying to create the display.

I have also noticed that I can't delete that new product and get the same error again.

Is this problem related? Should the patch address the issue on line 328? What else should I try?

rfay’s picture

@simonsparks you don't mention whether you visited the menu item that actually does the repairs, and saw a positive response there?

Edit: I noticed that I hadn't mentioned you have to do that on the project page, so I edited Commerce Repair project page to indicate that.

simonsparks’s picture

Thanks rfay. No, I hadn't followed the menu item.
I have now run the repair routine and the problems seem to be resolved.

Thanks again!

greysun’s picture

Commerce Repair did its job!

Thx rfay!

rfay’s picture

Yay! Great to hear these good reports.

rfay’s picture

Status: Needs work » Needs review

Not sure this issue is so relevant any more, but forcing a test of #95

rfay’s picture

Status: Needs review » Closed (won't fix)

I'm going to call this one obsolete, with too much water under the bridge. Many things have been applied (successfully) to this class of problems, and Commerce Repair has worked for most of the remaining. Marking "won't fix" but feel free to reopen.

mmncs’s picture

Status: Closed (won't fix) » Active

I've still got the problem.

I have following installed:

commerce 1.2
commerce_shipping 7.x-2.0-beta1
D7.12

I have applied the commerce_repair, but that doesn't help.

The problem occurs when I add a product to the cart and just before payment decides to either go back or click on a link to any page showing the shopping cart. Then on all pages which shows the shopping cart I get the:

EntityMetadataWrapperException: Unknown data property commerce_product. in EntityStructureWrapper->getPropertyInfo() (line 339 of /home/quickstart/websites/artunika.dk/sites/all/modules/contrib/entity/includes/entity.wrapper.inc).

If I then delete the shopping cart for that order the error disappears.

rszrama’s picture

Can you define "right before payment"? Do you mean from the actual payment redirect page they hit back? In that case, I'd expect them to not have a cart order at all. : ?

mmncs’s picture

On the review page, just before completion.

I would like to know if uninstalling commerce and doing a reinstall will delete all settings, tables and make then make a clean setup.

mmncs’s picture

I just tried to disable all commerce modules + contributed modules and ended up with this error, which has killed my installation:

Fatal error: Call to undefined method EntityValueWrapper::entityKey() in /home/quickstart/websites/artunika.dk/sites/all/modules/contrib/rules/modules/entity.eval.inc on line 115

Call Stack:
    0.0009     745944   1. {main}() /home/quickstart/drush/drush.php:0
    0.0214    3650624   2. drush_main() /home/quickstart/drush/drush.php:41
    0.1112    9935936   3. drush_bootstrap_to_phase() /home/quickstart/drush/drush.php:90
    0.1715   13113440   4. drush_bootstrap() /home/quickstart/drush/includes/environment.inc:310
    0.1719   13115112   5. _drush_bootstrap_drupal_full() /home/quickstart/drush/includes/environment.inc:194
    0.1720   13156280   6. drupal_bootstrap() /home/quickstart/drush/includes/environment.inc:956
    0.2250   19988872   7. _drupal_bootstrap_full() /home/quickstart/websites/artunika.dk/includes/bootstrap.inc:2164
    0.5429   65201440   8. module_invoke_all() /home/quickstart/websites/artunika.dk/includes/common.inc:5021
    0.5855   66643168   9. call_user_func_array() /home/quickstart/websites/artunika.dk/includes/module.inc:819
    0.5856   66643536  10. rules_init() /home/quickstart/websites/artunika.dk/includes/module.inc:0
    0.5860   66687152  11. rules_invoke_event() /home/quickstart/websites/artunika.dk/sites/all/modules/contrib/rules/rules.module:12
    0.5860   66687744  12. rules_get_cache() /home/quickstart/websites/artunika.dk/sites/all/modules/contrib/rules/rules.module:776
    0.5869   66689784  13. rules_get_cache() /home/quickstart/websites/artunika.dk/sites/all/modules/contrib/rules/rules.module:236
    0.5879   66690208  14. _rules_rebuild_cache() /home/quickstart/websites/artunika.dk/sites/all/modules/contrib/rules/rules.module:243
    0.9363   80697960  15. RulesEventSet->rebuildCache() /home/quickstart/websites/artunika.dk/sites/all/modules/contrib/rules/rules.module:273
    1.0219   80948088  16. rules_config_update_dirty_flag() /home/quickstart/websites/artunika.dk/sites/all/modules/contrib/rules/includes/rules.plugins.inc:704
    1.0219   80948248  17. Rule->integrityCheck() /home/quickstart/websites/artunika.dk/sites/all/modules/contrib/rules/rules.module:691
    1.0219   80948248  18. RulesContainerPlugin->integrityCheck() /home/quickstart/websites/artunika.dk/sites/all/modules/contrib/rules/includes/rules.plugins.inc:232
    1.0222   80948248  19. RulesAbstractPlugin->integrityCheck() /home/quickstart/websites/artunika.dk/sites/all/modules/contrib/rules/includes/rules.core.inc:1847
    1.0222   80948248  20. RulesPlugin->integrityCheck() /home/quickstart/websites/artunika.dk/sites/all/modules/contrib/rules/includes/rules.core.inc:1366
    1.0223   80948248  21. RulesAbstractPlugin->dependencies() /home/quickstart/websites/artunika.dk/sites/all/modules/contrib/rules/includes/rules.core.inc:758
    1.0223   80948248  22. RulesPlugin->dependencies() /home/quickstart/websites/artunika.dk/sites/all/modules/contrib/rules/includes/rules.core.inc:1447
    1.0223   80948560  23. RulesAbstractPlugin->pluginParameterInfo() /home/quickstart/websites/artunika.dk/sites/all/modules/contrib/rules/includes/rules.core.inc:674
    1.0225   80948560  24. RulesAbstractPlugin->forceSetUp() /home/quickstart/websites/artunika.dk/sites/all/modules/contrib/rules/includes/rules.core.inc:1394
    1.0225   80948560  25. RulesAbstractPlugin->setUp() /home/quickstart/websites/artunika.dk/sites/all/modules/contrib/rules/includes/rules.core.inc:1336
    1.0226   80957064  26. RulesExtendable->__call() /home/quickstart/websites/artunika.dk/sites/all/modules/contrib/rules/includes/rules.core.inc:1324
    1.0226   80957064  27. FacesExtendable->__call() /home/quickstart/websites/artunika.dk/sites/all/modules/contrib/rules/includes/rules.core.inc:293
    1.0228   80958792  28. call_user_func_array() /home/quickstart/websites/artunika.dk/sites/all/modules/contrib/rules/includes/faces.inc:123
    1.0228   80959536  29. rules_action_entity_create_info_alter() /home/quickstart/websites/artunika.dk/sites/all/modules/contrib/rules/includes/faces.inc:0
mmncs’s picture

After disabling all the rules I could uninstall all the commerce + contributed modules

mmncs’s picture

Status: Active » Closed (cannot reproduce)

Closing this for now since it looks like a reinstall has fixed the issue.

decibel.places’s picture

well this is strange

(I'm not sure if this belongs on this thread, related issues seem to be closed - well I'll post also at #1024206: EntityMetadataWrapperException: Unable to set the data property amount as the parent data structure is not set. in EntityStructu)

I was getting this error and so first I just commented out the line 442 in entity.wrapper.inc of entity-7.x-1.0-rc1

//throw new EntityMetadataWrapperException('Unable to get the data property ' . check_plain($name) . ' as the parent data structure is not set.');

then when I uncommented it for further tshooting, the error went away; I had already cleared cache, and run Commerce Repair etc. so I have no idea what "fixed" it.

some context:

My entire site was totally fubar for 2 days, I think because I tried to enable Storage API on local dev; anyway I pieced it back together and maybe something was unset that shouldn't have been.

Also I just installed an experimental module for Auction Bids http://drupal.org/node/1132004#comment-5620564 that depends on Entity and ECK

I know there's a much more recent dev version of Entity, but it's bewildering trying to figure out the right combo of "Recommended" and Dev modules in D7 so far. If there continue to be problems, perhaps I will try it.

Murz’s picture

Have the same problem, commenting out line in entity.wrapper.inc helps.

Summit’s picture

Status: Closed (cannot reproduce) » Active

Hi,
Setting this to active if thats ok. I have also the error. But in a traceble place I think what may be can help.

I have a view which shows the product display in a panel, this works fine with term choices like blue, white etc..the following fields:
- Content: Rendered Content --> Full content view
- (Product) Commerce product: SKU (SKU)

But when I change view mode on Content: Rendered Content to Teaser view, the error arise:

EntityMetadataWrapperException: Unknown data property commerce_product. in EntityStructureWrapper->getPropertyInfo() (regel 339 van sites/all/modules/entity/includes/entity.wrapper.inc).

When I change view mode back to full content view, the error is gone again.

The commerce_devel module gives me the following info:

EntityStructureWrapper->getPropertyInfo('commerce_product') entity.wrapper.inc:396
EntityStructureWrapper->get('commerce_product') entity.wrapper.inc:431
EntityStructureWrapper->__set('commerce_product', '7486') commerce_product_reference.module:1080
commerce_product_line_item_populate(Object, Object) commerce_product_reference.module:1057
commerce_product_line_item_new(Object, 1, 0, Array, 'happyproduct') commerce_cart.module:2184
commerce_cart_field_formatter_view('node', Object, Array, Array, 'und', Array, Array) field.default.inc:210
field_default_view('node', Object, Array, Array, 'und', Array, 'teaser', NULL) field.attach.inc:209
_field_invoke('view', 'node', Object, 'teaser', NULL, Array) field.attach.inc:386
_field_invoke_default('view', 'node', Object, 'teaser', NULL, Array) field.attach.inc:1181
field_attach_view('node', Object, 'teaser', 'nl') node.module:1361
node_build_content(Object, 'teaser', 'nl') node.module:1285
node_view(Object, 'teaser', NULL) node.module:2534
node_view_multiple(Array, 'teaser', 0, NULL) callbacks.inc:722
entity_metadata_view_node(Array, 'teaser', NULL, 'node') entity.module:397
entity_view('node', Array, 'teaser') entity_views_handler_field_entity.inc:183
entity_views_handler_field_entity->render_single_value(Object, Object) entity_views_handler_field_entity.inc:160
entity_views_handler_field_entity->render_entity_link(Object, Object) entity_views_field_handler_helper.inc:453
EntityFieldHandlerHelper::render_entity_link(Object, Object, Object) entity_views_field_handler_helper.inc:388
EntityFieldHandlerHelper::render(Object, Object) entity_views_handler_field_entity.inc:140
entity_views_handler_field_entity->render(Object) views_handler_field.inc:945
views_handler_field->advanced_render(Object) theme.inc:332
template_preprocess_views_view_field(Array, 'views_view_field') theme.inc:1008
theme(Array, Array) views_handler_field.inc:1284
views_handler_field->theme(Object) views_plugin_style.inc:320
views_plugin_style->render_fields(Array) views_plugin_style.inc:274
views_plugin_style->render_grouping(Array, '') views_plugin_style.inc:232
views_plugin_style->render(Array) theme.inc:51
template_preprocess_views_view(Array, 'views_view') theme.inc:1008
theme(Array, Array) views_plugin_display.inc:2468
views_plugin_display->render() view.inc:1035
view->render() views_plugin_display.inc:2536
views_plugin_display->preview() view.inc:1121
view->preview() views.inc:207
views_content_views_content_type_render('node_view', Array, Array, Array, '') content.inc:278
ctools_content_render('views', 'node_view', Array, Array, Array, Array) panels_renderer_standard.class.php:541
panels_renderer_standard->render_pane_content(Object) panels_renderer_standard.class.php:476
panels_renderer_standard->render_pane(Object) panels_renderer_standard.class.php:457
panels_renderer_standard->render_panes() panels_renderer_standard.class.php:378
panels_renderer_standard->render_layout() panels_renderer_standard.class.php:349
panels_renderer_standard->render() panels.module:729
panels_display->render(Object) panels.module:1057
panels_render_display(Object, Object) panel_context.inc:287
panels_panel_context_render(Object, Array, Array) context-task-handler.inc:103
ctools_context_handler_render_handler(Array, '', Object, Array, Array) context-task-handler.inc:44
ctools_context_handler_render(Array, '', Array, Array) node_view.inc:88
page_manager_node_view_page(Object) 
call_user_func_array('page_manager_node_view_page', Array) menu.inc:517
menu_execute_active_handler() index.php:21

Hopefully this is of help.

Greetings, Martijn

rszrama’s picture

Status: Active » Closed (cannot reproduce)

The only thing I can figure is that for one reason or another Views is trying to join on a property that isn't loaded into the node when you're only rendering the teaser. I have no clue why that would be happening, though. That said, I don't think "Content: Rendered content" exists any more; in my current version of things, it's "Node: Rendered node", so maybe that code has been changed / fixed in Entity API. I'd go ahead and update to the latest and see if the issue persists. If it does, this really sounds like a different issue that may not even be Commerce related since it's only happening through that Views field.

skyredwang’s picture

Version: 7.x-1.x-dev » 7.x-1.2
Priority: Normal » Critical
Status: Closed (cannot reproduce) » Active

I just ran into the same error after I disabled a product. This error prevents me going to the site from any page. I tried to re-enable the product from MySQL by updating the 0 to 1 in commerce_product table. However, still can't get in the site.

rszrama’s picture

Priority: Critical » Normal
Status: Active » Closed (cannot reproduce)

I'm not sure it's helpful to keep this old issue alive any time the error comes up. The error is just so generic that just about every time this is re-opened it's for a new scenario. I'm guessing you've recovered from your error, so what would be helpful would be a separate issue that explains what it was about disabling a product that suddenly caused the site to stop functioning (and how you recovered from the error).

I can think of no reason for a well-formed product to suddenly drop its "data" property - this is part of its schema and should simply always be loaded. It's likely there are some unknown module or configuration conflicts coming together to produce these errors.

DevElCuy’s picture

Status: Closed (cannot reproduce) » Active

There was a bug with UUID that is breaking modules depending on Entity API, check #1736780: EntityMetadataWrapperException Error - Conflict with Drupal commerce.

rszrama’s picture

Status: Active » Closed (cannot reproduce)

If it's been fixed, is there any reason to open this old report back up? If I'm not mistaken, we already had another thread in here about uuid incompatibility.

rsvelko’s picture

I scrolled to the bottom of this thread and found people speaking about commerce_repair.

THIS DID IT FOR ME.

I am using commerce 7.x-1.4 and

I had this "EntityMetadataWrapperException: Unknown data property commerce_customer_billing"

after deleting the billing / shipping ref fields from the order entity.

Installing this module http://drupal.org/project/commerce_repair and navigating to store -> settings -> repair fixed it for me. Then I disabled the module...

Just posting this for googlers.

ShaneOnABike’s picture

Turns out I was having this issue b/c of a recent upgrade from 1.4 to 1.5. Product Reference was no longer working :(

gorka’s picture

This also worked for me!

DamienMcKenna’s picture

FYI one site I was helping with was having this error because of a bug in commerce_product_kit: #1606378: Unknown data property commerce_product

Bik’s picture

Status: Closed (cannot reproduce) » Needs review
Issue tags: -dcsprint6

Status: Needs review » Needs work
Issue tags: +dcsprint6

The last submitted patch, commerce.repair_fields_1107788_94.patch, failed testing.

rszrama’s picture

Status: Needs work » Closed (cannot reproduce)

I don't get why this was reopened with testing for an old patch. Better to pursue it in the issue Damien linked, no?

rszrama’s picture

Issue summary: View changes

Added solution

SkyBuzz’s picture

Issue summary: View changes

When I updated the product display type's machine id, I did run into the problem on commerce 7.x-1.13. But, after running the cron error got disappeared automatically.

hkovacs’s picture

I just spent the day on this error being thrown on a panels page, and after numerous tests of various ideas, and after following the various links, and after trying the solution listed above, and absolutely refusing to destroy my commerce install and re-install again...

So my problem turned out to be a product type... just one type was corrupted and causing this crazy error...

So I deleted the product type. Yes, I will need to rebuild it, but considering that we aren't even using the problematic product type at the moment, it is a simple thing to delete the type and rebuild it some other time.

SO FOR EVERYONE ELSE ARRIVING AT THIS PAGE:
Go to admin/commerce/products and click on each of your product types. The one which is problematic will throw the error. The rest are good. Try to avoid uninstalling the whole commerce system. Just figure out if you can fix the product or rebuild it if you can't.

RedEight’s picture

No clue why I'm getting this today... Commerce 7.13.
I'm creating products through the UI. Doesn't matter if they are a new product type I create or the "Product" type that is installed by default. I can create new products just fine. Now comes the fun part.
If I try to add them as a line item to the order I get this error.
If I try to delete them from the product list, I get this error.
If I create a content type with a product reference and then create a node with a reference to any product, viewing the node gives me the error.

However, the following work just fine:
Searching for products in the order creation form finds the product just fine. Clicking it once it has been found triggers the error.
Viewing the product on admin/commerce/products works just fine.
Editing the product via admin/commerce/products/{product_id}/edit works just fine, heck it even creates the revision.
Deleting the product programmatically via commerce_product_delete({product_id}) works just fine.
Selecting the product via the product reference field when creating a node for the product works just fine. It's only when I try to view the node that has the reference that it suicides...

At this point, I'm starting to wonder if I'm just cursed by some "impending vacation = random critical failure" which will of course correct itself as soon as my vacation is over.

shobhit_juyal’s picture

FileSize
153.42 KB

I can reproduce the error...

I've downloaded Drupal 7.57 and enabled all drupal modules via drush
commerce
devel
commerce devel

Then I have generated 5 dummy product and it's content for product display and then the error re produced.

Fortunately, the above solutions worked for me. That's why I think that this bug should be marked as fixed at least.

nayanalok’s picture

Install "Commerce Repair" module, enable it.

Repair commerce installation from admin/commerce/config, this will surely resolve your problem.

Once fields are working fine uninstall Commerce Repair module.

sano’s picture

"Commerce Repair" module did not do it for me.

In my case, the error occurred after deleting a custom line item (functionality provided by the Commerce Customizable Products module). After adding it back using the same machine name the problem went away. See corresponding bug in that module issue list.