EntityMetadataWrapperException: Unknown data property commerce_discounts. in EntityStructureWrapper->getPropertyInfo() (line 339 of drupal/profiles/commerce_kickstart/modules/contrib/entity/includes/entity.wrapper.inc).

I get this above error when I tried to create an order in the admin interface and trying to save it.

Edit: I'm also getting this same error on the admin/commerce/orders/carts page after updating to Kickstart 7.x-1.21.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bojanz’s picture

Hm, that's problematic.

Try disabling commerce_discount until we can look into this.

jsacksick’s picture

Status: Active » Postponed (maintainer needs more info)

I just tried to create an order and saved it I wasn't able to reproduce the bug, I created an order and I tried with/without a discount and it worked.

Deciphered’s picture

I have also reproduced this issue, however i don't currently have time to debug or write reproduction steps as I'm on the clock for a client trying to prototype something else. I will try to come back to this issue at another stage but no guarantees.

gstone007’s picture

I have this same error but it is generated during execution of a Rule during cron run. The Rule creates a new Commerce Order and then saves it. It might be valuable information to know that the Rule in questions is the "Generate Recurring Orders" from the latest dev version of the Commerce Recurring module.

vasike’s picture

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

this looks like duplicate (a report) of this Commerce Discount issue #1835528: commerce_discount_usage_commerce_order_insert function crash others module using bundle of commerce_order entity type..
which was already fixed and its solution included in Commerce kickstart (Commerce Discount upgrades).

jenlampton’s picture

Version: 7.x-2.0-rc4 » 7.x-1.21
Issue summary: View changes
Status: Closed (fixed) » Active

I'm getting this same error on the admin/commerce/orders/carts page after updating to Kickstart 7.x-1.21.
I'm running the 7.x-1.0-alpha3 version of commerce_discount, which was released long after that patch was committed.

Since the only difference between the view at admin/commerce/orders/carts and admin/commerce/orders is the status of the order, I tried toggling the statuses and the only times the error appears is when the status is either "cart" or "checkout". In both cases the error is generated.

The view seems to work fine on the live site, but when the database is exported and brought into a dev environment, everything goes haywire. I'm not sure what discount line items may have to do with active sessions, but that may be the root of the problem.

I expect this may be something to do with the way commerce discount line items behave when they are in the cart, or checkout.

cassandra04’s picture

Hi, I am also getting this error when using commerce kickstart with commerce_marketplace module. I am using the latest version. Does anyone know how to fix it?

murinello’s picture

Hi,
I'm getting the same error in line 335 with Kickstart 7.x-2.12 after enable Commerce Marketplace Order 7.x-1.0-beta2

juaninf’s picture

Hi,

I'm getting the same error EntityMetadataWrapperException: Unknown data property commerce_discounts. in EntityStructureWrapper->getPropertyInfo() (line 335 of /var/www/turegalo/profiles/commerce_kickstart/modules/contrib/entity/includes/entity.wrapper.inc).

when I'm trying to access mange order.

thanks

lsolesen’s picture

Status: Active » Postponed (maintainer needs more info)

@PedroVale @juaninf @cassandra04 Could you please supply the exact steps to reproduced on CK 2.x?

lsolesen’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Guessing that this has been fixed by now, since there is no activity. If it is still an issue, please reopen with exact steps to reproduce.

andyg5000’s picture

Status: Closed (cannot reproduce) » Closed (duplicate)
Chithra K’s picture

Version: 7.x-1.21 » 7.x-2.15
Status: Closed (duplicate) » Needs work

I am getting the same error when I access the "All products" page. I have commerce_marketplace(7.x-1.0-beta2) and eck(7.x-2.0-rc2) enabled.

I am using a fresh installation of kickstart .The only thing I did in the site is enabling the above modules and added a sample product. I haven't added any of the categories.

lsolesen’s picture

Priority: Major » Normal
Status: Needs work » Active
andyg5000’s picture

@chitz07 did you try the patch in the issue from comment 12? If not please do. If so please update with more info.

Chithra K’s picture

I did try the patch, but unfortunately that didn't work. I am still getting the error
EntityMetadataWrapperException: Unknown data property commerce_discounts. in EntityStructureWrapper->getPropertyInfo() (line 335 of /../commerce_kickstart-7.x-2.15/profiles/commerce_kickstart/modules/contrib/entity/includes/entity.wrapper.inc).
when I try accessing the pages.

andyg5000’s picture

Hey @chitz07, turns out there are multiple places in commerce discount where the commerce_discounts wrapper property is accessed without being checked. I've updated the patch to do this check each time.

https://www.drupal.org/node/2285199#comment-8953643

Can you review the new patch and see if it fixes your issue? If not, would you mind backtracing line 335 of the entity metadata wrapper to determine what function is calling *wrapper*->commerce_discounts?

I guess this issue should stay open until the commerce_discount module is patched and the update is included in the next Kickstart release.

themic8’s picture

andyg5000,

I have tried the patch and this issue is still there.

I'm on Commerce Kickstart 7.x-2.14

andyg5000’s picture

Hey @themic8, I've noticed that there are issues with commerce_coupon and commerce_discounts that can cause this. They both have very similar error messages because they're both related to the same exception. This should be fixed by downloading the latest -dev versions of commerce_discounts and commerce_coupons. Let me know if you're still having problems. It may require that we backtrace the error to see where the call is actually coming from.

themic8’s picture

@andyg5000, I have updated both to the latest dev and now I am receiving this error: Unknown data property commerce_discounts

I also have commerce marketplace installed.

themic8’s picture

@andyg5000, I have disabled the marketplace module, made sure I was using both the latest dev versions of commerce_coupon and commerce_discount. This error does not appear anymore.

lsolesen’s picture

@andyg5000 Are you able to reproduce this on the latest dev of Kickstart? Could you supply the exact steps, it would be very helpful.

mglaman’s picture

Project: Commerce Kickstart » Commerce Discount
Version: 7.x-2.15 » 7.x-1.x-dev

Looks like a bug in Commerce Discount. There's been a lot of work done, so I'm sure this could probably get closed.

joelpittet’s picture

Status: Active » Closed (cannot reproduce)

Closing this, if someone can provide a scenario to reproduce this. Feel free to reopen or create a new issue.

wqmeng’s picture

Still get this error.

Message EntityMetadataWrapperException: Unknown data property commerce_discounts. in EntityStructureWrapper->getPropertyInfo() (line 335 of /home/www/xxx.com/sites/all/modules/entity/includes/entity.wrapper.inc).

wqmeng’s picture

Status: Closed (cannot reproduce) » Active
joelpittet’s picture

Status: Active » Postponed (maintainer needs more info)

@wqmeng can you put a watchdog() message in entity.wrapper.inc on that line 335 and get a backtrace from that error so we at least know which function is asking for that property? That would really help narrow down the problem.

joelpittet’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
2.65 KB

Actually #27 would be helpful, but here is a general entity_metadata_wrapper cleanup. There are a couple suspect checks in the wrong order or using the wrong type of check for entity metadata wrappers and this may help.

If you can reproduce these error, it would help to try this patch too.

Status: Needs review » Needs work

The last submitted patch, 28: 1872922-28.patch, failed testing.

joelpittet’s picture

Status: Needs work » Needs review
FileSize
2.65 KB
603 bytes

Typo in that last one.

wqmeng’s picture

Hello joelpittet,

I added the patch, but still get error of this, so that I finally find the problem also exist in the module commerce_coupon .

Here is what I changed.

/all/modules/commerce_coupon/commerce_coupon.module

function commerce_coupon_order_discount_ids($order) {

  // Add the set of discounts directly referenced on the order.
  if(isset($order_wrapper->commerce_discounts)){
    foreach ($order_wrapper->commerce_discounts->raw() as $discount_id) {
      $order_discount_ids[] = $discount_id;
    }
  }
joelpittet’s picture

@wqmeng Can you open up an issue in commerce_coupon so the issue is tracked there and post the link here?

  • joelpittet committed bc38824 on 7.x-1.x
    Issue #1872922 by joelpittet: EntityMetadataWrapperException: Unknown...
joelpittet’s picture

I've committed #30 because in some cases it could solve a problem with EMW and others it just brings consistency for how the magic methods are used. The other two cases that are particularly bad areempty() doesn't work with EMW and the other one the isset() check is second after it's already tried to get the value() of it.

joelpittet’s picture

Status: Needs review » Postponed (maintainer needs more info)

I'll postpone this for a couple of weeks and if someone sees this with head and not commerce_coupon related then feel free to re-open.

If you can reproduce this error, try to get a stack trace because that would help a ton to solve this.

oystercrackher’s picture

Hello, I am also getting this error after creating a coupon within a discount. Here is the error message and stack trace info:

Please advise on any suggestions.

Thanks

exception 'EntityMetadataWrapperException' with message 'Unknown data property commerce_discount_offer.' in /data/disk/o4945186064/static/jgd-prod5.15-core-v7.39-om8/drupal-7.x/sites/all/modules/contrib/entity/includes/entity.wrapper.inc:335
Stack trace:
#0 /data/disk/o4945186064/static/jgd-prod5.15-core-v7.39-om8/drupal-7.x/sites/all/modules/contrib/entity/includes/entity.wrapper.inc(392): EntityStructureWrapper->getPropertyInfo('commerce_discou...')
#1 /data/disk/o4945186064/static/jgd-prod5.15-core-v7.39-om8/drupal-7.x/sites/all/modules/contrib/entity/includes/entity.wrapper.inc(413): EntityStructureWrapper->get('commerce_discou...')
#2 /data/disk/o4945186064/static/jgd-prod5.15-core-v7.39-om8/drupal-7.x/sites/all/modules/contrib/commerce_discount/includes/commerce_discount.controller.inc(65): EntityStructureWrapper->__get('commerce_discou...')
#3 /data/disk/o4945186064/static/jgd-prod5.15-core-v7.39-om8/drupal-7.x/sites/all/modules/contrib/entity/includes/entity.inc(215): CommerceDiscountControllerExportable->save(Object(CommerceDiscount))
#4 /data/disk/o4945186064/static/jgd-prod5.15-core-v7.39-om8/drupal-7.x/sites/all/modules/contrib/entity/entity.module(283): Entity->save()
#5 /data/disk/o4945186064/static/jgd-prod5.15-core-v7.39-om8/drupal-7.x/sites/all/modules/contrib/entity/entity.module(942): entity_save('commerce_discou...', Object(CommerceDiscount))
#6 /data/disk/o4945186064/static/jgd-prod5.15-core-v7.39-om8/drupal-7.x/sites/all/modules/contrib/entity/entity.module(853): _entity_defaults_rebuild('commerce_discou...')
#7 /data/disk/o4945186064/static/jgd-prod5.15-core-v7.39-om8/drupal-7.x/sites/all/modules/contrib/commerce_shipping/commerce_shipping.module(177): entity_defaults_rebuild()
#8 /data/disk/o4945186064/static/jgd-prod5.15-core-v7.39-om8/drupal-7.x/sites/all/modules/contrib/commerce_shipping/commerce_shipping.module(153): _commerce_shipping_default_rules_reset(Array)
#9 [internal function]: commerce_shipping_modules_enabled(Array)
#10 /data/disk/o4945186064/static/jgd-prod5.15-core-v7.39-om8/drupal-7.x/includes/module.inc(895): call_user_func_array('commerce_shippi...', Array)
#11 /data/disk/o4945186064/static/jgd-prod5.15-core-v7.39-om8/drupal-7.x/includes/module.inc(499): module_invoke_all('modules_enabled', Array)
#12 /data/disk/o4945186064/static/jgd-prod5.15-core-v7.39-om8/drupal-7.x/sites/all/modules/contrib/features/features.module(649): module_enable(Array)
#13 /data/disk/o4945186064/static/jgd-prod5.15-core-v7.39-om8/drupal-7.x/sites/all/modules/contrib/features/includes/features.features.inc(70): features_install_modules(Array)
#14 [internal function]: dependencies_features_rebuild('sdtn_base_comme...', 'dependencies')
#15 /data/disk/o4945186064/static/jgd-prod5.15-core-v7.39-om8/drupal-7.x/sites/all/modules/contrib/features/features.module(594): call_user_func_array('dependencies_fe...', Array)
#16 /data/disk/o4945186064/static/jgd-prod5.15-core-v7.39-om8/drupal-7.x/sites/all/modules/contrib/features/features.module(998): features_invoke('dependencies', 'features_rebuil...', 'sdtn_base_comme...')
#17 /data/disk/o4945186064/static/jgd-prod5.15-core-v7.39-om8/drupal-7.x/sites/all/modules/contrib/features/features.module(1026): _features_restore('rebuild', Array)
#18 /data/disk/o4945186064/static/jgd-prod5.15-core-v7.39-om8/drupal-7.x/sites/all/modules/contrib/features/features.module(275): features_rebuild()
#19 [internal function]: features_flush_caches()
#20 /data/disk/o4945186064/static/jgd-prod5.15-core-v7.39-om8/drupal-7.x/includes/module.inc(895): call_user_func_array('features_flush_...', Array)
#21 /data/disk/o4945186064/static/jgd-prod5.15-core-v7.39-om8/drupal-7.x/includes/common.inc(7796): module_invoke_all('flush_caches')
#22 /data/disk/o4945186064/tools/drush/commands/core/drupal/cache.inc(99): drupal_flush_all_caches()
#23 /data/disk/o4945186064/tools/drush/includes/drush.inc(707): drush_cache_clear_both()
#24 /data/disk/o4945186064/tools/drush/includes/drush.inc(694): drush_call_user_func_array('drush_cache_cle...', Array)
#25 /data/disk/o4945186064/tools/drush/commands/core/cache.drush.inc(143): drush_op('drush_cache_cle...')
#26 [internal function]: drush_cache_command_clear('all')
#27 /data/disk/o4945186064/tools/drush/includes/command.inc(368): call_user_func_array('drush_cache_com...', Array)
#28 /data/disk/o4945186064/tools/drush/includes/command.inc(219): _drush_invoke_hooks(Array, Array)
#29 [internal function]: drush_command('all')
#30 /data/disk/o4945186064/tools/drush/includes/command.inc(187): call_user_func_array('drush_command', Array)
#31 /data/disk/o4945186064/tools/drush/lib/Drush/Boot/BaseBoot.php(62): drush_dispatch(Array)
#32 /data/disk/o4945186064/tools/drush/drush.php(70): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#33 /data/disk/o4945186064/tools/drush/drush.php(11): drush_main()
#34 {main}

oystercrackher’s picture

Status: Postponed (maintainer needs more info) » Active
joelpittet’s picture

That is a different error, can you open up a new issue. A scan of the call stack (which is very helpful btw, thanks)
Shows that features is rebuilding and it looks like commerce_shipping is involved it exporting a discount.

Please provide version numbers for those modules and steps to reproduce if possible.
The discount export would be helpful as well if you have it

joelpittet’s picture

Also looks like drush is involved...

drupbasic’s picture

Hi,

I am using discount 7x-1.0.alpha 7 and also getting this error. Even with all coupon modules switched off. Because of this error I cannot change the status from orders beyond the 'payment' point. So cannot set them to completed. Which means there's a lot of things not being 'triggered' such as email confirmation to client etc...
I really do need the discount module to enable free shipping (without a coupon) for all order above a certain total amount.
Should I install the dev version on a production site?
Error msg in screenshot.
Thx

ben van den broeck’s picture

I also got this error, even when using the latest dev. It started on updating to alpha7 version of commerce_discount. The patch was not working for me. The only solution was to place back a back-up.

joelpittet’s picture

@drupbasic does the -dev version fix the problem? (aka download the production database locally to see if dev will fix it). If so I'll gladly make another alpha release.

joelpittet’s picture

@ben van den broeck With -dev you run into this problem? Are you using coupon?

There is no place in the code base in -dev right now that is trying to access that property without first checking it exists so a debug_backtrace() from where you are both getting that error from would really help track down the culprit

mglaman’s picture

So... Shouldn't that property always be available unless the wrapper has an empty order? The discount module requires that field.

andyg5000’s picture

We should make it a standard to wrap these in try catch and handle the exceptuons properly. Making assumptions that all bundles will always have these properties continues to bite us in the ars in all of commerce contrib :)

I'm happy to review these next week but and taking a screen break this weekend!

joelpittet’s picture

Status: Active » Postponed (maintainer needs more info)

@andyg5000 if we had to try catch every use of a EMW property "properly" I'm quite sure the codebase would nearly double without huge benefit. We need to make reasonable assumptions about our EMW objects. I already am checking the existence of that property in the issue summary in all places in our codebase. If we 'expect' there are situations where this property doesn't exist and it must exist, try catch would be a good idea. I'd really like to know where people are running into that, and a backtrace would really help point this out.

As it is right now I highly doubt this exception is related to commerce_discount due to the checks I've committed so re-postponing until someone provides a backtrace proving otherwise.

drupbasic’s picture

As a follow up to #40: after some tryouts on my local website (thx acquia dev desktop!) I got rid of the error. I kept the alpha 7 release but I completely removed the 'sub' module 'usage' of Drupal discount. So not just disabled it but also removed it, cleared cache, PHP update... until the 'maximum usage' field did no longer appear on the add discount screen. That fixed the error for me and the discount module still works for free shipping on all orders above a certain amount, as I wanted. Hope this helps. I have the discount_coupon module switched off. Now I have to figure out a way to get the coupon module to work without getting new errors.

UPDATE:
found that when I added a second discount. 10% off all products - no coupon module installed the entity wrapper error appeared again. So even without the usage module active the discount module only works for one discount.

mglaman’s picture

drupbasic thanks! In -dev usage was merged into the main module. Since you can reproduce, could you give it a try to see if it still exists? If it does, then we can dive into the code and figure out what is happening!

drupbasic’s picture

Hi

Did my homework :-)
Installed the -dev version of commerce discount. Still with coupon module not installed and I'm sorry to tell it does not work. Even with just one discount active when finishing the order (so after selecting payment) the entity wrapper error appears. So the dev version is actually a step backwards for me as the alpha version works for 1 discount when I remove the usage module. Added a screenshot of the only active discount. Will try other discount types and see if -dev version of module works. Let me know if you need additional info.

UPDATE:
tried % off total order amount: didn't work
tried fixed amount off total order amount: didn't work either
here's the error line again that appears with whichever discount I create:
EntityMetadataWrapperException: Unknown data property commerce_discounts. in EntityStructureWrapper->getPropertyInfo() (regel 335 van /Users/Kim/Sites/devdesktop/sites/all/modules/entity/includes/entity.wrapper.inc).

Would be happy to do the backtrack if that's useful but don't have a clue how to do that, so I would need instructions for that.

drupbasic’s picture

Can Anyone write this watchdog code for me and tell me were to paste it? I would be happy to provide you with the output in order to fix this error.

joelpittet’s picture

@drupbasic thanks for providing more information. I think someone on IRC was having a similar issue and had some sort of reproducible scenario that I'm hoping he will post here.

Re #50 Paste this right above the line that throws the exception.
http://dropbucket.org/node/7043

joelpittet’s picture

joelpittet’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
6.84 KB

Ok I looked closely at the access to the data property retrieval and replaced all (except for tests) with commerce_price_wrapper_value() which will also default the ['data']['components'] array which were are usually after.

If this passes test, please test this patch resolves the issue.

Status: Needs review » Needs work

The last submitted patch, 53: 1872922-53.patch, failed testing.

joelpittet’s picture

Status: Needs work » Needs review
FileSize
6.69 KB

Was a couple typos.

joelpittet’s picture

Issue tags: +commerce-sprint
mglaman’s picture

+++ b/commerce_discount.module
@@ -949,13 +947,12 @@ function commerce_discount_usage_order_discounts($order) {
-    if (!$line_item_wrapper->value() || !isset($line_item_wrapper->commerce_unit_price)) {
+    if (!isset($line_item_wrapper->commerce_unit_price)) {

Shouldn't we still check if the line item exists here?

mglaman’s picture

Status: Needs review » Reviewed & tested by the community

Nevermind, this only gets called in commerce_discount_usage_record_order_usage() which is invoked on insert and update, so no chance of line item being moot.

joelpittet’s picture

Not sure what would be a better check there. The line item wrapper is NULL or a metadata wrapper. And I think it's null when commerce_entitycache goes weird. (or entity controller cache, hasn't been resolved).

The isset on the property I think will cover both cases in one shot better... I think anyway...

  • joelpittet committed 185aa94 on 7.x-1.x
    Issue #1872922 by joelpittet, drupbasic, mglaman, andyg5000, lsolesen,...
joelpittet’s picture

Status: Reviewed & tested by the community » Fixed

I've committed the patch in #55. I'm a bit fearful of marking this fixed. But please try the latest -dev release. And if you are still running into this, hunt me down and we'll get to the bottom of this.

timbraeckman’s picture

Hi joel,

I installed the latest dev version and now it works again.
Last time i got it to work too but when there was a new order, it suddenly wasn't possible to edit orders anymore again.
Keep you posted man!

grts

timbraeckman’s picture

Having the same problem again!

Problem with editing orders is still there when i have a discount rule based on role. It always works perfect, until someone buys something in our store and a user is created with rules. I disabled the discount module again because i couldn't edit my orders anymore again.

Hope we can find a fix for this so i can start giving discounts to my friends! :)

joelpittet’s picture

@timbraeckman can you try my snippet in #51 to get a backtrace in watchdog on the error?

timbraeckman’s picture

I enabled the discount module again so my discount is back but i don't get the error anymore when editing an order. So perhaps it will occur again when i get a new order in my shop and than it will throw the error everytime for each order edit. Very weird!!

timbraeckman’s picture

I get this error now:
EntityMetadataWrapperException: Unknown data property commerce_discounts. in EntityStructureWrapper->getPropertyInfo() (regel 335 van /data/sites/web/tresorabe/www/sites/all/modules/entity/includes/entity.wrapper.inc).

But only when i change the status of an order with an owner (user) to "Bezig". When i change to "Voltooid" (completed) it doesn't throw this error...
If it's an order with anonymous user i can change to any order status...

backtrace didn't put anything in logs :(

andyg5000’s picture

@timbraekman, can you way in on #2661530: New critical EntityMetadataWrapperException I feel that should solve your problem.

Updated: Thank you Erik!

torgosPizza’s picture

Status: Fixed » Closed (fixed)

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

timbraeckman’s picture

Joel i finally have a local copy of my website and added backtrace to all errors of my website.
I only keep getting this critical error when changing the status of an order to "Bezig" (busy in english) when there is a discount on the order.

Here is the backtrace:

EntityMetadataWrapperException: Unknown data property commerce_discounts. in EntityStructureWrapper->getPropertyInfo() (line 335 of /Applications/MAMP/htdocs/tresora/sites/all/modules/entity/includes/entity.wrapper.inc). Backtrace:
Array
(
    [0] => Array
        (
            [line] => 335
            [file] => /Applications/MAMP/htdocs/tresora/sites/all/modules/entity/includes/entity.wrapper.inc
        )

    [1] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/sites/all/modules/entity/includes/entity.wrapper.inc
            [line] => 392
            [function] => getPropertyInfo
            [class] => EntityStructureWrapper
            [type] => ->
        )

    [2] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/sites/all/modules/entity/includes/entity.wrapper.inc
            [line] => 413
            [function] => get
            [class] => EntityStructureWrapper
            [type] => ->
        )

    [3] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/sites/all/modules/commerce_discount/commerce_discount.module
            [line] => 1097
            [function] => __get
            [class] => EntityStructureWrapper
            [type] => ->
        )

    [4] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/sites/all/modules/commerce_discount/commerce_discount.module
            [line] => 1121
            [function] => commerce_discount_usage_order_discounts
        )

    [5] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/sites/all/modules/commerce_discount/commerce_discount.module
            [line] => 1037
            [function] => commerce_discount_usage_record_order_usage
        )

    [6] => Array
        (
            [function] => commerce_discount_commerce_order_update
        )

    [7] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/includes/module.inc
            [line] => 951
            [function] => call_user_func_array
        )

    [8] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/sites/all/modules/commerce/includes/commerce.controller.inc
            [line] => 98
            [function] => module_invoke_all
        )

    [9] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/sites/all/modules/commerce/includes/commerce.controller.inc
            [line] => 244
            [function] => invoke
            [class] => DrupalCommerceEntityController
            [type] => ->
        )

    [10] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/sites/all/modules/commerce/modules/order/includes/commerce_order.controller.inc
            [line] => 119
            [function] => save
            [class] => DrupalCommerceEntityController
            [type] => ->
        )

    [11] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/sites/all/modules/commerce/modules/order/commerce_order.module
            [line] => 744
            [function] => save
            [class] => CommerceOrderEntityController
            [type] => ->
        )

    [12] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/sites/all/modules/commerce_backoffice/commerce_backoffice_order.module
            [line] => 190
            [function] => commerce_order_save
        )

    [13] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/includes/form.inc
            [line] => 1519
            [function] => commerce_backoffice_order_status_form_submit
        )

    [14] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/includes/form.inc
            [line] => 903
            [function] => form_execute_handlers
        )

    [15] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/includes/form.inc
            [line] => 385
            [function] => drupal_process_form
        )

    [16] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/includes/form.inc
            [line] => 130
            [function] => drupal_build_form
        )

    [17] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/sites/all/modules/commerce_backoffice/commerce_backoffice_order.module
            [line] => 133
            [function] => drupal_get_form
        )

    [18] => Array
        (
            [function] => commerce_backoffice_order_entity_view
        )

    [19] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/includes/module.inc
            [line] => 951
            [function] => call_user_func_array
        )

    [20] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/sites/all/modules/commerce/includes/commerce.controller.inc
            [line] => 342
            [function] => module_invoke_all
        )

    [21] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/sites/all/modules/entity/entity.module
            [line] => 558
            [function] => buildContent
            [class] => DrupalCommerceEntityController
            [type] => ->
        )

    [22] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/sites/all/modules/commerce/includes/commerce.controller.inc
            [line] => 405
            [function] => entity_build_content
        )

    [23] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/sites/all/modules/entity/entity.module
            [line] => 622
            [function] => view
            [class] => DrupalCommerceEntityController
            [type] => ->
        )

    [24] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/sites/all/modules/commerce_backoffice/commerce_backoffice_order.module
            [line] => 47
            [function] => entity_view
        )

    [25] => Array
        (
            [function] => commerce_backoffice_order_view
        )

    [26] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/includes/menu.inc
            [line] => 527
            [function] => call_user_func_array
        )

    [27] => Array
        (
            [file] => /Applications/MAMP/htdocs/tresora/index.php
            [line] => 21
            [function] => menu_execute_active_handler
        )

)
timbraeckman’s picture

Status: Closed (fixed) » Needs work
VaithianathanV’s picture

Version: 7.x-1.x-dev » 7.x-1.0-alpha8

I am getting the following error when the commerce marketplace order, commerce discounts and commerce coupons modules are enabled. I am not getting error when only commerce discounts and commerce coupons are enabled.

The error is as follows.

EntityMetadataWrapperException: Unknown data property commerce_discounts. in EntityStructureWrapper->getPropertyInfo() (line 335 of /var/www/html/test/sites/all/modules/contrib/entity/includes/entity.wrapper.inc).

On backtracing the error line i am getting the following output.

[
{
"file": "\/var\/www\/html\/test\/sites\/all\/modules\/contrib\/entity\/includes\/entity.wrapper.inc",
"line": 395,
"function": "getPropertyInfo",
"class": "EntityStructureWrapper",
"object": {

},
"type": "->"
},
{
"file": "\/var\/www\/html\/test\/sites\/all\/modules\/contrib\/entity\/includes\/entity.wrapper.inc",
"line": 416,
"function": "get",
"class": "EntityStructureWrapper",
"object": {

},
"type": "->"
},
{
"file": "\/var\/www\/html\/test\/sites\/all\/modules\/contrib\/commerce_coupon\/commerce_coupon.module",
"line": 1240,
"function": "__get",
"class": "EntityStructureWrapper",
"object": {

},
"type": "->"
},
{
"file": "\/var\/www\/html\/test\/sites\/all\/modules\/contrib\/commerce_coupon\/commerce_coupon.module",
"line": 1161,
"function": "commerce_coupon_order_discount_ids"
},
{
"file": "\/var\/www\/html\/test\/sites\/all\/modules\/contrib\/commerce_coupon\/commerce_coupon.module",
"line": 1360,
"function": "commerce_coupon_order_coupon_code_discounts"
},
{
"function": "commerce_coupon_commerce_cart_order_refresh"
},
{
"file": "\/var\/www\/html\/test\/includes\/module.inc",
"line": 951,
"function": "call_user_func_array"
},
{
"file": "\/var\/www\/html\/test\/sites\/all\/modules\/contrib\/commerce\/modules\/cart\/commerce_cart.module",
"line": 1146,
"function": "module_invoke_all"
},
{
"file": "\/var\/www\/html\/test\/sites\/all\/modules\/contrib\/commerce_coupon\/includes\/commerce_coupon.checkout_pane.inc",
"line": 90,
"function": "commerce_cart_order_refresh"
},
{
"file": "\/var\/www\/html\/test\/sites\/all\/modules\/contrib\/commerce\/modules\/checkout\/includes\/commerce_checkout.pages.inc",
"line": 107,
"function": "commerce_coupon_pane_checkout_form"
},
{
"function": "commerce_checkout_form"
},
{
"file": "\/var\/www\/html\/test\/includes\/form.inc",
"line": 841,
"function": "call_user_func_array"
},
{
"file": "\/var\/www\/html\/test\/includes\/form.inc",
"line": 464,
"function": "drupal_retrieve_form"
},
{
"file": "\/var\/www\/html\/test\/includes\/form.inc",
"line": 973,
"function": "drupal_rebuild_form"
},
{
"file": "\/var\/www\/html\/test\/includes\/ajax.inc",
"line": 386,
"function": "drupal_process_form"
},
{
"function": "ajax_form_callback"
},
{
"file": "\/var\/www\/html\/test\/includes\/menu.inc",
"line": 527,
"function": "call_user_func_array"
},
{
"file": "\/var\/www\/html\/test\/index.php",
"line": 21,
"function": "menu_execute_active_handler"
}
]

joelpittet’s picture

Version: 7.x-1.0-alpha8 » 7.x-1.x-dev
Status: Needs work » Closed (fixed)

@VaithianathanVLooks like that may be in this function from your callstack: commerce_coupon_order_discount_ids
Which is maybe a bug in commerce_coupon.

ThirstySix’s picture

I am using Commerce_marketplace module. Discount type "Product discount" is working correctly. but, Discount type "Order discount" not working..

$order_discount_ids are not set in the commerce_coupon_order_discount_ids($order) function.. Because, Line item type "commerce_discount" is not added in the order type. How can we set the commerce_discount line item in the order?

Thanks in advance.

ThirstySix’s picture

drupbasic’s picture

Hi, hate to re-open this but the problem persists. As I update my drupal commerce, the discount module was update to alpha 8 and I had the same problems again. See #40 and also #66 seems to have same problem.
The error prevent the shopping cart from getting from 'payment' to 'waiting. So the discount is applied correctly but causes the checkout to fail to complete. Although the customer can proceed to the review page, complete the payment but at the end (where the cart should be updated to 'waiting') this error appears instead of 'thank you for order XXX etc...' :
EntityMetadataWrapperException: Unknown data property commerce_discounts. in EntityStructureWrapper->getPropertyInfo() (regel 335 van /Applications/MAMP/htdocs/WOLWERELD/sites/all/modules/entity/includes/entity.wrapper.inc).
This is the discount that I have created:
Type: order discount
Conditions: Total amount product exceeds X EUR
Offer type: FREE SHIPPING
Shipping service : X
Compatible with all
Free shipping discount strategy: discount all other shipping services by the same amount as the selected shipping service

The error ONLY appears when all of these conditions are met:
-the user in an anonymous user
-the user selects shipping service X

So the error does not appear when the user is logged in or when shipping service Y or Z are choosen. The discount is applied correctly to all the shipping services so this works.

I did try to paste the backtrace snipped above the line that throws the error but then website doesn't start anymore. So no backtrace yet.
Solution: uninstall alpha 8, install alpha 7, delete the submodule 'usage' and the error doesn't appear anymore.
Would love to be able to use alpha 8 and the coupon module so if you can reproduce and find a fix that would be great.

drupbasic’s picture

Can you re-open this?

Alex Bukach’s picture

In my case the issue persisted, and it was caused by the fact that the commerce_discounts field was created only for the default commerce order bundle, why I use another bundle. Here's the patch. Should I create another issue for that?

jsacksick’s picture

Status: Closed (fixed) » Needs review

jsacksick’s picture

Status: Needs review » Fixed

@Alex Bukach: Committed your patch.

Status: Fixed » Closed (fixed)

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