Magento getIsInStock error

Boon Chye Phang
Boon Chye Phang used Ask the Experts™
Magento CE having server 500 error on some product pages. The error message is:
Call to a member function getIsInStock() on null

Open in new window

PHP fatal error
Why it happened and how do I fix it?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
David FavorFractional CTO
Distinguished Expert 2018

Looks like ->getIsInStock() was called on a NULL object.

You'll just have to dig into your version of Magento + figure out how to fix this.

Likely, you had some SQL sequence of statements run outside a transaction, which was aborted... so you have partial data in your database which causes Magento to think there's an object to work on + then when the object instantiation occurs... the object can't really be created completely.

If you turn on debugging in Magento, then check your logs, likely you'll find clues about how to fix this.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial