I also hit the error described in #1897634: Fatal error: Call to a member function value() on a non-object, and after updating to 1.1 I get EntityMetadataWrapperException: Unable to get the data property product_id as the parent data structure is not set..

I was getting the previous Call to a member function value() on a non-object error on a field where I had never changed the cardinality, so I'm thinking something else is in play.

I've attached the result of echo '<pre>'; print_r($product_wrapper->{$field_name}->product_id); die; added just before line 111 of commerce_pado.module. I'm not sure if it will be helpful, but I'm not at all familiar with parsing that structure.

CommentFileSizeAuthor
entity_metadata_dump.txt90.19 KBakalata

Comments

akalata’s picture

Looking a little bit down the module's code (I only have one product to reference so I was thinking I might be able to hardcode values), line 112 wants to set a value as $product_wrapper->{$field_name}->value(). When I put that in the print_r as mentioned above, nothing is printed.

jazzdrive3’s picture

Status: Active » Postponed (maintainer needs more info)

You'll have to explain your setup exactly so I can try and replicate. It works fine for me. Or do some debugging and submit a possible patch.

torgospizza’s picture

Encountered the same error, on a fairly normal Commerce installation. Enabled the module, created an Entityreference field, and checked the Add-on Options box. Added a product reference on a DVD product (to another DVD) but get hung on this Fatal error. Only by unchecking the Add-on Option checkbox for that field can I get the error to go away.

I'll try digging into this a bit more to see if I can nail down the exact cause. The full error is:

EntityMetadataWrapperException: Unable to get the data property product_id as the parent data structure is not set. in EntityStructureWrapper->getPropertyValue() (line 442 of //sites/all/modules/entity/includes/entity.wrapper.inc).

andrechun’s picture

I ran into the same error too but I was able to fix it by making sure when you create the entity reference field, you set the "Target type" setting to "Commerce Product". By default it is set to "Node".

jazzdrive3’s picture

I will add some extra help verbiage to make it clear that the entity type must be set to Commerce Product. I also added a validation handler that prevents people from using this while have a target type of anything other than a product. This should solve this issue.

Eventually, I wonder if we can force it to be a Commerce Product target type, either with AJAX or a submit handler.

Committed to dev.

jazzdrive3’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)