This appears to be a duplicate of Commerce Kickstart error #2312841
I'm on Drupal 7.31. I'm also using Customizable Products 7.x-1.0-beta2+1-dev and Select (or other) 7.x-2.20.
I've added a donation line item type to include a donation amount configured with Select (or other) and a donation category implemented as a Taxonomy term.
I created the DONATION product. Then, I created a Donation content type to include a Product reference. Last, I created Content "Donation to Church" instantiating the Donation content type and using the DONATION product. During content creation, I asked for a menu item. The dialog said that the content had been created. It also included the error:
EntityMetadataWrapperException: Unknown data property commerce_product. in EntityStructureWrapper->getPropertyInfo() (line 335 of ...sites\all\modules\commerce\entity\includes\entity.wrapper.inc)
The menu item was created, so I invoked it and got the error. Attempting to display the content type in any way that includes the Product reference creates the error.
Comments
Comment #1
vgriffin commentedThis occurs if there is a problem displaying the particular commerce_product. In my case, I had forgotten to select the correct line item type in the add-to-cart widget displaying the Product reference.
It would be useful to display an error message or, at least, to tell us to look at the definition for our commerce_product.
Comment #2
rszrama commentedCan you help me out with reproducing this issue perhaps? Was it trying to build the Add to Cart form with a non-product line item type perhaps, and that's why it couldn't find the "commerce_product" it was looking for in the wrapper?
Comment #3
vgriffin commentedAs I mentioned, I'm using the current versions of Customizable Products and Select (or other). To the best of my recollection, I performed the following steps to generate the error.
I added a line-item type of Donation with the following fields, all using the standard machine-readable name:
Donation category - Term reference to its own vocabulary (General, Music programs, etc. where a person can direct a donation)
Donation amount - Integer displayed as Select (or other) with values like 15|15.00, 100|100.00, etc.
Comment - Long text in a Text area
I created sku/name DONATION/Donation as a product. I did not create a new product type.
I added the following rule to change the price to the value entered into the Donation amount field:
{ "rules_update_price_to_donation_amount" : {
"LABEL" : "Update Price to donation amount",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "commerce_line_item", "commerce_product_reference" ],
"ON" : { "commerce_product_calculate_sell_price" : [] },
"IF" : [
{ "entity_has_field" : { "entity" : [ "commerce-line-item" ], "field" : "field_donation_amount" } }
],
"DO" : [
{ "data_calc" : {
"USING" : {
"input_1" : [ "commerce-line-item:field-donation-amount" ],
"op" : "*",
"input_2" : "100"
},
"PROVIDE" : { "result" : { "donation_cents" : "Donation cents" } }
}
},
{ "commerce_line_item_unit_price_amount" : {
"commerce_line_item" : [ "commerce_line_item" ],
"amount" : [ "donation-cents" ],
"component_name" : "base_price",
"round_mode" : "1"
}
}
]
}
}
I created a Content Type of Donation to give me the ability to put the donation on the menu. This Content Type marks the item as Published, but not Promoted, without comments or author display.
I added a Product reference (Label and field type), without configuring its display. (This turned out to cause the problem.)
I created a Donation content entry, filling in the title and description. For Product reference, I used DONATION. I told it to create a menu link. That's when I got the error. (The menu link isn't relevant to getting the error.) Whenever I tried to display the content, I got the error.
To make the error stop, I deleted the content entry (probably not necessary), used Manage Display in the Donation content type to configure the Add to Cart form to set the line item type to Donation, instead of the default Product, and created a new Donation entry.
Comment #4
bojanz commented