EntityMalformedException: Missing bundle property on entity of type commerce_order. in entity_extract_ids() (line 7539 of /var/www/vhosts/mydomain.com/httpdocs/includes/common.inc).
So far, I didn't notice any broken functionality due to this error.

Comments

pcambra’s picture

Status: Active » Postponed (maintainer needs more info)

Not been able to reproduce this error, do you have some steps to reproduce it?

FriedJam’s picture

Hi, I'm getting a similar error for the "Redeem a coupon with fixed amount" & "Calculate coupon with percentage amount", & at one point "Apply percentage coupons to product line item" (it disappeared after disabling & re-enabling the module). They display this error:

Error: Data selector commerce-order:commerce-coupon-order-reference for parameter list is invalid

Which then produces a site-wide error when you add a coupon :)

pcambra’s picture

Oh, that's not quite similar, that probably is reflecting that you don't have the coupon order reference field in your order entity.
Could you browse to admin/commerce/config/order/fields and check if there's a coupon_order_reference field there?

FriedJam’s picture

Yep, there is commerce_coupon_order_reference, but when I click edit I get "Fatal error: Class name must be a valid object or a string in /includes/common.inc on line 7656"

It's highly likely that it's something that I've done - I've been using all of the latest dev releases & come across a number of bugs so I've had to uninstall/install the modules a number of times. Probably somewhere along the way I've done something (possibly in the database) in uninstalling that has caused a knock-on effect. But I thought it'd be worth mentioning in case it is related?

Drupa1ish’s picture

@FriedJam I don't think also that is the same error, @pcambra is right at #3
My error looks the same as http://drupal.org/files/commerse-error-when-editing-an-order.png. #1577596: EntityMalformedException: Missing bundle property on entity of type commerce_customer_profile might be related

pcambra’s picture

I recommend that you install Commerce Devel and paste the detailed error in here.

Drupa1ish’s picture

An ugly workaround...

Changing the widget of the commerce_coupon_order_reference attached to order from autocomplete to select list should fix the issue.
Just hoping this won't break something else...

In order to change the widget field, just temporary comment the line entity_extract_ids() (line 7539 of /var/www/vhosts/trb2.euro-domeni.eu/httpdocs/includes/common.inc) ( than revert the hack)

ponies’s picture

@FriedJam I'm getting the same error when I try to edit an order. Were you able to track it down?

drupalninja99’s picture

I am getting this error "EntityFieldQueryException: Unknown field: commerce_coupon_order_reference in EntityFieldQuery->addFieldCondition() (line 769 of /[path]/includes/entity.inc).

I get this error just after adding a coupon and viewing /admin/commerce/coupons. I am guessing there is some dependency that is not being enforced? I don't understand where the order reference field is required?

I am reading the documentation and I don't see where a reference field is required:
http://drupalcode.org/project/commerce_coupon.git/blob_plain/refs/heads/...

I am reading #7 and I see:
"Changing the widget of the commerce_coupon_order_reference attached to order from autocomplete to select list should fix the issue.
Just hoping this won't break something else..."

Where is this widget? I don't see any kind of a widget for "Order reference"

gdoteof’s picture

I am getting

EntityMalformedException: Missing bundle property on entity of type commerce_order. in entity_extract_ids() (line 7633 of /var/www/jv/includes/common.inc).

On a pretty vanilla commerce install (drupal install has a lot going on, but commerce was just enabled).

This error comes up when clicking checkout and trying to enter a coupon.

heshanlk’s picture

I'm also getting EntityMalformedException: Missing bundle property on entity of type commerce_order. in entity_extract_ids(), I've changed the field setting and choose Percentage coupon as bundle, none of the above *dirty* fixes worked for me.

farse’s picture

Yup, this is giving me all kinds of headaches as well.

The field is listed in the fields, but trying to edit it throws the error.

I am also getting an error that the table 'field_data_commerce_coupon_order_reference' doesn't exist (when I try to create an order) and when I checked, yup, the field table doesn't exist.

I tried several times uninstalling (removing all tables and data related to commerce coupon) and installing again. It creates the commerce_coupon and commerce_coupon_type tables fine, but none of the data fields (ie. field_data_commerce_coupon_*).

I was successful once in getting this to work on my staging site (which works on the same version of drupal 7.16 and commerce_coupon 7.x-1.0-beta7 as live)

But when i went to start over from taking a snapshot of live, it just does not want to work.

I am trying to rack my brain all thinking if there's some left over data or something... but dunno any more... only god knows now..

farse’s picture

think I might of found a solution... if you run these two commands (in dev.php or whatever)

commerce_coupon_line_item_configuration();
commerce_coupon_order_configuration(); //especially this one

it should recreate the commerce_coupon_order_reference field if it doesn't exist.

pcambra’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Closed (won't fix)

As @facine comments, there are a number of workarounds when you're coming from an old version or updating, check this documentation page: https://drupal.org/node/1626506 and this issue for that matter: https://drupal.org/node/1604918

hcderaad’s picture

Running commerce_coupon_order_configuration(); does indeed create the needed reference field on the order, solving this error. Using Commerce Kickstart 2 with Drupal 7.30.