I get this error when I go to a product display page for any newly created product/display.

Steps I took: create a new product and saying "yes" to the question if I also wanted to create a Display. Then trying to go to the page that displays the product.

EntityMetadataWrapperException: Unknown data property commerce_product. in EntityStructureWrapper->getPropertyInfo() (line 345 of /XXX/profiles/commerce_kickstart/modules/contrib/entity/includes/entity.wrapper.inc).
The website encountered an unexpected error. Please try again later.

The problem stems from an ungraceful fail that begins with
if (!isset($this->propertyInfo['properties'][$name])) {

When it fails $name="commerce_product" but when I do a

      foreach($this->propertyInfo as $key => $value) {
        error_log("KEY=".print_r($key,TRUE));
        error_log(print_r($value,TRUE));
      }

I get nothing about commerce_product ...

KEY=properties
(
    [field_ap_email_address] => Array
        (
            [label] => Email Address for activation link
            [type] => text
            [description] => Field "field_ap_email_address".
            [getter callback] => entity_metadata_field_property_get
            [setter callback] => entity_metadata_field_property_set
            [access callback] => entity_metadata_field_access_callback
            [query callback] => entity_metadata_field_query
            [translatable] =>
            [field] => 1
            [required] => 1
        )

    [line_item_id] => Array
        (
            [label] => Line item ID
            [description] => The internal numeric ID of the line item.
            [type] => integer
            [schema field] => line_item_id
        )

    [order_id] => Array
        (
            [label] => Order ID
            [type] => integer
            [description] => The unique ID of the order the line item belongs to.
            [setter callback] => entity_property_verbatim_set
            [setter permission] => administer line items
            [clear] => Array
                (
                    [0] => order
                )

            [schema field] => order_id
        )

    [order] => Array
        (
            [label] => Order
            [type] => commerce_order
            [description] => The order the line item belongs to.
            [getter callback] => commerce_line_item_get_properties
            [setter callback] => commerce_line_item_set_properties
            [setter permission] => administer line items
            [required] => 1
            [computed] => 1
            [clear] => Array
                (
                    [0] => order_id
                )

        )

    [type] => Array
        (
            [label] => Type
            [description] => The human readable name of the line item type.
            [type] => token
            [setter callback] => entity_property_verbatim_set
            [options list] => commerce_line_item_type_options_list
            [required] => 1
            [schema field] => type
        )

    [line_item_label] => Array
        (
            [label] => Line item label
            [description] => The label displayed with the line item.
            [type] => text
            [setter callback] => entity_property_verbatim_set
            [required] => 1
            [schema field] => line_item_label
        )

    [quantity] => Array
        (
            [label] => Quantity
            [description] => Quantity associated with this line item
            [type] => decimal
            [getter callback] => entity_property_verbatim_get
            [setter callback] => entity_property_verbatim_set
            [required] => 1
            [schema field] => quantity
        )
    [created] => Array
        (
            [label] => Date created
            [description] => The date the line item was created.
            [type] => date
            [setter callback] => entity_metadata_verbatim_set
            [setter permission] => administer line items
            [schema field] => created
        )

    [changed] => Array
        (
            [label] => Date changed
            [description] => The date the line item was most recently updated.
            [type] => date
            [schema field] => changed
        )

    [commerce_unit_price] => Array
        (
            [label] => Unit price
            [type] => commerce_price
            [description] => Field "commerce_unit_price".
            [getter callback] => entity_metadata_field_verbatim_get
            [setter callback] => entity_metadata_field_verbatim_set
            [access callback] => entity_metadata_field_access_callback
            [translatable] =>
            [field] => 1
            [required] => 1
            [auto creation] => commerce_price_field_data_auto_creation
            [property info] => Array
                (
                    [amount] => Array
                        (
                            [label] => Amount
                            [description] =>
                            [type] => decimal
                            [getter callback] => entity_property_verbatim_get
                            [setter callback] => entity_property_verbatim_set
                        )

                    [amount_decimal] => Array
                        (
                            [label] => Amount (decimal)
                            [description] =>
                            [type] => decimal
                            [getter callback] => commerce_price_amount_decimal_get
                            [computed] => 1
                        )

                    [currency_code] => Array
                        (
                            [label] => Currency
                            [description] =>
                            [type] => text
                            [getter callback] => entity_property_verbatim_get
                            [setter callback] => entity_property_verbatim_set
                            [options list] => commerce_currency_code_options_list
                        )

                    [data] => Array
                        (
                            [label] => Data
                            [description] =>
                            [type] => struct
                            [getter callback] => entity_property_verbatim_get
                            [setter callback] => entity_property_verbatim_set
                        )

                )

        )

    [commerce_total] => Array
        (
            [label] => Total
            [type] => commerce_price
            [description] => Field "commerce_total".
            [getter callback] => entity_metadata_field_verbatim_get
            [setter callback] => entity_metadata_field_verbatim_set
            [access callback] => entity_metadata_field_access_callback
            [translatable] =>
            [field] => 1
            [required] => 1
            [auto creation] => commerce_price_field_data_auto_creation
            [property info] => Array
                (
                    [amount] => Array
                        (
                            [label] => Amount
                            [description] =>
                            [type] => decimal
                            [getter callback] => entity_property_verbatim_get
                            [setter callback] => entity_property_verbatim_set
                        )

                    [amount_decimal] => Array
                        (
                            [label] => Amount (decimal)
                            [description] =>
                            [type] => decimal
                            [getter callback] => commerce_price_amount_decimal_get
                            [computed] => 1
                        )

                    [currency_code] => Array
                        (
                            [label] => Currency
                            [description] =>
                            [type] => text
                            [getter callback] => entity_property_verbatim_get
                            [setter callback] => entity_property_verbatim_set
                            [options list] => commerce_currency_code_options_list
                        )

                    [data] => Array
                        (
                            [label] => Data
                            [description] =>
                            [type] => struct
                            [getter callback] => entity_property_verbatim_get
                            [setter callback] => entity_property_verbatim_set
                        )

                )

        )

)
-------------------
KEY=bundles
(
    [product] => Array
        (
            [properties] => Array
                (
                    [commerce_unit_price] => Array
                        (
                            [label] => Unit price
                            [type] => commerce_price
                            [description] => Field "commerce_unit_price".
                            [getter callback] => entity_metadata_field_verbatim_get
                            [setter callback] => entity_metadata_field_verbatim_set
                            [access callback] => entity_metadata_field_access_callback
                            [translatable] =>
                            [field] => 1
                            [required] => 1
                            [auto creation] => commerce_price_field_data_auto_creation
                            [property info] => Array
                                (
                                    [amount] => Array
                                        (
                                            [label] => Amount
                                            [description] =>
                                            [type] => decimal
                                            [getter callback] => entity_property_verbatim_get
                                            [setter callback] => entity_property_verbatim_set
                                        )

                                    [amount_decimal] => Array
                                        (
                                            [label] => Amount (decimal)
                                            [description] =>
                                            [type] => decimal
                                            [getter callback] => commerce_price_amount_decimal_get
                                            [computed] => 1
                                        )

                                    [currency_code] => Array
                                        (
                                            [label] => Currency
                                            [description] =>
                                            [type] => text
                                            [getter callback] => entity_property_verbatim_get
                                            [setter callback] => entity_property_verbatim_set
                                            [options list] => commerce_currency_code_options_list
                                        )

                                    [data] => Array
                                        (
                                            [label] => Data
                                            [description] =>
                                            [type] => struct
                                            [getter callback] => entity_property_verbatim_get
                                            [setter callback] => entity_property_verbatim_set
                                        )

                                )

                        )

                    [commerce_total] => Array
                        (
                            [label] => Total
                            [type] => commerce_price
                            [description] => Field "commerce_total".
                            [getter callback] => entity_metadata_field_verbatim_get
                            [setter callback] => entity_metadata_field_verbatim_set
                            [access callback] => entity_metadata_field_access_callback
                            [translatable] =>
                            [field] => 1
                            [required] => 1
                            [auto creation] => commerce_price_field_data_auto_creation
                            [property info] => Array
                                (
                                    [amount] => Array
                                        (
                                            [label] => Amount
                                            [description] =>
                                            [type] => decimal
                                            [getter callback] => entity_property_verbatim_get
                                            [setter callback] => entity_property_verbatim_set
                                        )

                                    [amount_decimal] => Array
                                        (
                                            [label] => Amount (decimal)
                                            [description] =>
                                            [type] => decimal
                                            [getter callback] => commerce_price_amount_decimal_get
                                            [computed] => 1
                                        )

                                    [currency_code] => Array
                                        (
                                            [label] => Currency
                                            [description] =>
                                            [type] => text
                                            [getter callback] => entity_property_verbatim_get
                                            [setter callback] => entity_property_verbatim_set
                                            [options list] => commerce_currency_code_options_list
                                        )

                                    [data] => Array
                                        (
                                            [label] => Data
                                            [description] =>
                                            [type] => struct
                                            [getter callback] => entity_property_verbatim_get
                                            [setter callback] => entity_property_verbatim_set
                                        )

                                )

                        )

                    [commerce_product] => Array
                        (
                            [label] => Product
                            [type] => commerce_product
                            [description] => Field "commerce_product".
                            [getter callback] => entity_metadata_field_property_get
                            [setter callback] => entity_metadata_field_property_set
                            [access callback] => entity_metadata_field_access_callback
                            [query callback] => entity_metadata_field_query
                            [translatable] =>
                            [field] => 1
                            [required] => 1
                            [options list] => entity_metadata_field_options_list
                        )

                    [commerce_display_path] => Array
                        (
                            [label] => Display path
                            [type] => text
                            [description] => Field "commerce_display_path".
                            [getter callback] => entity_metadata_field_property_get
                            [setter callback] => entity_metadata_field_property_set
                            [access callback] => entity_metadata_field_access_callback
                            [query callback] => entity_metadata_field_query
                            [translatable] =>
                            [field] => 1
                            [required] => 1
                        )

                )
        )

    [commerce_discount] => Array
        (
            [properties] => Array
                (
                    [commerce_unit_price] => Array
                        (
                            [label] => Unit price
                            [type] => commerce_price

Comments

jsacksick’s picture

Status: Active » Postponed (maintainer needs more info)

Can you provide more details, because I tried to create products and I never had this issue. Please provide the path used for your operations and the installation you're running on (Demo/no demo mode)

rar’s picture

In looking more carefully I get this error when I change the line item type from the standard to a custom one that
was built from commerce_examples module and then try to view that product's display node.

Environment:

Linux DEVSERVER 3.2.0-27-generic #43-Ubuntu SMP Fri Jul 6 14:25:57 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Ubuntu 12.04.1 LTS

Path used for operations? I just re-duplicated it with a new product/variation and recorded the path

admin/commerce/config/product-variation-types -> /admin/commerce/config/product-variation-types/add
(Yes - Create matching product display type, No - Save as new revisions)

Press "save and add fields" - get error:

Product variation type saved.

Error messageNotice: Undefined variable: product_type in commerce_backoffice_product_variation_type_form_submit() (line 258 of /XXX/profiles/commerce_kickstart/modules/contrib/commerce_backoffice/includes/commerce_backoffice_product.product_variation_types.inc).

The new product type = testingfoobar

Going to admin/structure/types/manage/testingfoobar/fields/field_product

Notice: Undefined variable: entity_info in inline_entity_form_field_widget_settings_form() (line 237 of /XXX/profiles/commerce_kickstart/modules/contrib/inline_entity_form/inline_entity_form.module).

Going to "manage Display" for that product: admin/structure/types/manage/testingfoobar/display

Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1545 of /XXX/includes/bootstrap.inc).

and change the Product Variations Default and uncheck "Display textfield quantity widget" and uncheck "attempt to combine like products"

Still can get to that page (URL alias=foobar.htm) .

If I then change the line-item type to one I created in FOO_lineitems.module

function FOO_lineitems_commerce_line_item_type_info() {
  $line_item_types['customtextwithproduct'] = array(
    'name' => t('CustomTextWithProduct'),
    'description' => t('A customizable product line item type'),
    'product' => TRUE,

    // Here you can change the text in the submit button in the order admin form.
    'add_form_submit_value' => t('Add to cart'),

    // 'base' basically provides magic naming for a set of callbacks
    // including the settings_form, checkout_form, etc. Here we'll use the
    // forms and callbacks provided for Commerce Product Reference module for
    // its product line item, so we'll use
    // commerce_product_line_item_configuration()
    // and commerce_product_line_item_title(), etc.
    // See example_line_item_2 for explicit callbacks.
    'base' => 'commerce_product_line_item',
  );

and then when I try to view that product's page (foobar.htm) I get the error.

bojanz’s picture

Error messageNotice: Undefined variable: product_type in commerce_backoffice_product_variation_type_form_submit() (line 258 of /XXX/profiles/commerce_kickstart/modules/contrib/commerce_backoffice/includes/commerce_backoffice_product.product_variation_types.inc).

This is an unrelated & harmless notice that is already fixed in the backoffice -dev version.

Notice: Undefined variable: entity_info in inline_entity_form_field_widget_settings_form() (line 237 of /XXX/profiles/commerce_kickstart/modules/contrib/inline_entity_form/inline_entity_form.module).

Known (and also harmless) Inline Entity Form bug, has a patch in the queue.

Didn't read the rest, but those two are definitely unrelated.

rar’s picture

> Didn't read the rest, but those two are definitely unrelated.

I understand, but I was just going through the entire path and reporting all errors until I got to the last one.
So the fact that it is unrelated is interesting, but it's really the last error that I'm trying to solve because it
means the product can't be sold.

jsacksick’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)
rar’s picture

Status: Closed (fixed) » Active

Got a workaround

/profiles/commerce_kickstart/modules/contrib/entity/modules/callbacks.inc

line 613 of function entity_metadata_no_hook_node_access

if (isset($node)) { 

should be instead

if (is_object($node)) { 

Commerce product passed $node in as a non-object variable that entity_metadata_no_hook_node_access couldn't handle. I think it is because my products are complex and involve entity-lookups and the recursion that happens causes a failure as the entity isn't a node type?

Anyway - making the above change - fixed my issue. Technically this is outside of commerce (just in the contrib provided in commerce kickstart) or in how commerce is calling the entity module badly for complex products.

bojanz’s picture

Status: Active » Closed (fixed)

IEF is no longer passing non-object values there, so latest kickstart should have that fixed.