Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have been getting this error on Features diff pages for some time, but the weird thing is it's intermittent:
> ( ! ) Fatal error: Call to a member function set_display() on a non-object in sites/all/modules/contrib/commerce/commerce.module on line 362
A backtrace shows this is coming from commerce_cart_block_view() trying to embed the view 'commerce_cart_block'.
Could this be because Features is doing something wacky with Views on these pages?
Comment | File | Size | Author |
---|---|---|---|
#6 | 1803516-6-commerce_cart_block.patch | 711 bytes | joelpittet |
Comments
Comment #1
glennpratt CreditAttribution: glennpratt commentedAre you using memcache? We see the same issue from time to time and that's my best guess.
Comment #2
joachim CreditAttribution: joachim commentedNo, I don't have memcached on my local machine and we haven't set it up yet on the dev server for my current project, so it's not that that's causing it for me.
Comment #3
m.stentaI am also getting this on occasion, but I'm getting it in Checkout, and any pages that display the shopping cart block.
I can fix it by clearing the cache.
It's inconsistent, but I'll keep my eyes peeled, and dig in if it happens again. I'll post updates if I find any.
Comment #4
m.stentaCorrection: I can fix it by clearing the Views cache. It appears that sometimes that Commerce default Views disappear.
When the error is occurring, they do not show up in the Views admin list. None of the Commerce Views do, so going to any page that tries to use one of them gives this error.
Comment #5
rszrama CreditAttribution: rszrama commentedUntil we have a reproducible problem here, I'm going to mark this "needs more info." I've never experienced the presenting issue (Views disappearing), so I can't confirm whether or not it's a problem in our modules or another.
Comment #6
joelpittetI'm not 100% positive but from the looks of it, this is because the wrong name of the display is passed into commerce_cart_block_view(). It should be the display_id of 'default' not 'defaults' which is the human name not the machine name of that view.
So here's a patch.
Comment #7
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedI get this same error, when using Commerce Coupon 2.x with a % discount. The patch above does not fix this particular problem.
This comment fixed it for me: https://www.drupal.org/node/2173963#comment-8913647
Comment #8
rszrama CreditAttribution: rszrama commentedNot sure if #6 is the original issue or not, but that's definitely a typo needing to be fixed. It appears the issue may be in another module, so I'm going to mark this a tentative fixed based on #6 but we can always reopen later if need be.
Comment #10
joelpittet@rszrama I think I saw it originally in commerce_ajax_cart which I am now a co-maintainer so I'll keep my eye out.
Thanks for the fix and commit mention!
Comment #11
rszrama CreditAttribution: rszrama commentedYou bet - thanks for the patch. : )