When enabling the Product Review block I get the following on a Producct page.

EntityMetadataWrapperException: Unable to get the data property file as the parent data structure is not set. i EntityStructureWrapper->getPropertyValue() (linje 442 af /data/disk/o2/static/commerce-kickstart-2.9--20130728-/profiles/commerce_kickstart/modules/contrib/entity/includes/entity.wrapper.inc).

Comments

dwkitchen’s picture

Issue summary: View changes

You probably need to set your product field on the Yotpo settings form. There is now a check for this.

dwkitchen’s picture

Status: Active » Needs review
lsolesen’s picture

Version: 7.x-1.x-dev » 7.x-1.0-rc3
Status: Needs review » Active

Same error is till present - and the product field has been set.

dwkitchen’s picture

Think we have found the problem, do you have a product that doesn't have an image?

dwkitchen’s picture

Status: Active » Fixed

Added a check that the image field is not empty.

lsolesen’s picture

Tried the newest version, and it seems to be fixed allright.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

macman911’s picture

Status: Closed (fixed) » Needs review

Hi, love Yotpo but I can't use it because I'm still getting the error. Using process of elimination I have found the fault, but I don't know how to fix it.

Instead of using the Drupal default body field for the product descriptions I created a new field for each product variation called "field_variation_description". This allows me to list different specifications/descriptions for each variation. I only use the body field to write further information about the product variations in general. The product review block appears for products which include text in the body field, however I get the error message for products with an empty body field. I would be extremely grateful if someone could help. Thank you.

dwkitchen’s picture

Status: Needs review » Closed (fixed)

What you are experiencing was passably a duplicate of #2113655: Send historic orders gives error

macman911’s picture

Unfortunately after trying the latest release 7.x-1.1 I still get the same error.

macman911’s picture

Status: Closed (fixed) » Needs review

I also get the error when I enable the Product Bottom Line block on pages that don't have a product description for instance on non product pages (or on product pages which don't have any text in the body field). I believe the bottom line block provides the review tab?

klagler’s picture

I'm using the latest release and have an similar issue when enabling the review block:

EntityMetadataWrapperException: Unable to get the data property value as the parent data structure is not set. in EntityStructureWrapper->getPropertyValue() (line 438....

klagler’s picture

As macman911 mentioned above the problem seems to be the missing body field on product pages.
There should be a validation if the body field exists on line 123, 171 and 351 in commerce_yotpo.module

if ($node_wrapper) {
           $description = $node_wrapper->body->value->value(array('decode' => TRUE));
         }

otherwise you will get this EntityMetadataWrapperException error if the body field is not present.

martinezsalmeron’s picture

I get the same error, so I am not being able to use the module.

I would really appreciate any ideas ;)

macman911’s picture

Martinezsalmeron, if it helps my temporary solution is to only display the review blocks on pages where the body field is filled in. For me this means it at least works on 1/2 of my products.

jassics’s picture

I have same issue in my site http://www.cusatalumni.com

Whenever we try to post any comment on blog or forum, it is giving internal error page.

In error report it is showing:

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

and under http://www.cusatalumni.com/user#overlay=admin/reports/fields
it shows following warnings too:
Notice: Undefined index: comment_node_panel in _field_ui_bundle_admin_path() (line 325 of /home6/cusatalu/public_html/modules/field_ui/field_ui.module).
Notice: Undefined index: comment_node_panel in field_ui_fields_list() (line 35 of /home6/cusatalu/public_html/modules/field_ui/field_ui.admin.inc).
Notice: Undefined index: message_type in _field_ui_bundle_admin_path() (line 325 of /home6/cusatalu/public_html/modules/field_ui/field_ui.module).
Notice: Undefined index: message_type in field_ui_fields_list() (line 35 of /home6/cusatalu/public_html/modules/field_ui/field_ui.admin.inc).

It is driving me crazy. I tried various methods, enable/disabled many modules but no use

dwkitchen’s picture

jassics, looks like you are using panels to display your products.

I haven't tested with panels so will have to look at why it can't get the information it needs for the Widget.

joelpittet’s picture

Status: Needs review » Active

I'm using panels too, but what seems to be the issue is the body field being empty in my case. Trying to debug and see if I can't provide a patch.

So far it's happening here for me:
$description = $body_value->value->value(array('decode' => TRUE));

Which is what #13 mentioned.

This could be a bug with entity module (currently using dev version of entity 7.x-1.5+2-dev).

joelpittet’s picture

Version: 7.x-1.0-rc3 » 7.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new1.34 KB

Ok quick fix for now.

joelpittet’s picture

joelpittet’s picture

Though that patch does seem to work, I think it's not correct...

joelpittet’s picture

StatusFileSize
new1.97 KB

It's doing the call twice, that's why I mentioned that it's not correct in #21, here's a better version, I'm manually doing the decode because this seems to be a bug with either panels or entity framework.

This side side steps the decode feature of entity framework for now without making multiple calls. This may be a micro optimization of #19 but you can be the judge...

joelpittet’s picture

Whoops, forgot to grab the value from the value... in #21 oh well, now I like #19 better. So hiding #22

joelpittet’s picture

@dwkitchen This is reproducible without panels I just checked to see if it was part of the mix.

Install entity
Create a custom module block:

<?php

/**
 * Implements hook_block_info().
 */
function custom_block_info() {
  $blocks['testimonials'] = array(
    'info' => t('TEST'),
    'cache' => DRUPAL_CACHE_GLOBAL,
  );
  return $blocks;
}

/**
 * Implements hook_block_view().
 */
function custom_block_view($delta = '') {
  switch ($delta) {
    case 'testimonials':
      $node = menu_get_object();
      $node_wrapper = $node ? entity_metadata_wrapper('node', $node) : NULL;
      if ($node_wrapper) {
        $description = $node_wrapper->body->value->value(array('decode' => TRUE));
      }
  }
}

Add that to a node with an empty body field and voila.

vasike’s picture

i think this error is not more present.

However i think we need better settings for product fields.
1. Description field settings : we can use other field than node body field.
2. With 1. implemented, for both fields - image & description - we need fields from both entities types - product & product display (node) - available to be used.
Maybe we have the description in the product or mnaybe we have the image in the node.

there is a patch with an implementation for these.

Could you please review the patch and provide some feedback on this?
Thank you

P.S. QUESTION:
What if there are multiple product display types, product reference fields, product types?

joelpittet’s picture

@vasike Thanks, I think I was not on -dev which was part of the problem but I unearthed a bit about the issue in the issue summary.

The bug lies in the entity module from my perspective but my patch in #19 works around the bug until it's fixed in #1596594: EntityMetadataWrapperException: Parent Data Structure Not Set.

Though I'm sure most of the code you've written is good, I suggest it be in a new feature request issue as it doesn't relate to the issue summary which is solely about the Exception.

joelpittet’s picture

Oh just a note, it looks like you fixed a different bug, here:

-    if ($node_wrapper && !empty($node_wrapper->body)) {
-      $description = $node_wrapper->body->value(array('decode' => TRUE));
...
+      $description_value = $description_field_wrapper->value();
+      if (!empty($description_value)) {
+        if ($description_field_info['type'] == 'text_with_summary') {
+          $product_data['description'] = $description_field_wrapper->value->value(array('decode' => TRUE));
+        }
+        else {
+          $product_data['description'] = $description_field_wrapper->value(array('decode' => TRUE));
+        }
+      }

Before body->value(array('decode' => TRUE)); Does absolutely nothing more than returning value(). Where as your code checks for empty() value first like my fix in #19 then does body->value->value(array('decode' => TRUE)); Which actually does what it's trying to do.

Nice work!

vasike’s picture

there is a new patch, some fixes for the previous one (#25).

the same request/question.

Could you please review the patch and provide some feedback on this?
Thank you

P.S. QUESTION:
What if there are multiple product display types, product reference fields, product types?

joelpittet’s picture

@vasike again, could you move this to a new issue so that it relates to the issue summary? The patch in #28 likely does some nice things but it's unclear how it helps the problem posted in the summary.

In addition, it would nice if you could provide an interdiff between patches so we can see the changes you've made and not have to re-read the entire patch to get up to speed. @see https://www.drupal.org/documentation/git/interdiff

joelpittet’s picture

Status: Needs review » Closed (fixed)

Actually even better, this issue was already closed. It should be still closed.

The 7.x-1.x-dev version this issue doesn't exist anymore.