I get
php fatal error: Call to a member function getWelcome() on boolean in /home/cloudpanel/htdocs/domain.com/app/code/core/Mage/Page/Block/Html/Welcome.php on line 43.
How to solve this error in Magento 1.7?
class Mage_Page_Block_Html_Welcome extends Mage_Core_Block_Template
{
/**
* Get block messsage
*
* @return string
*/
protected function _toHtml()
{
return Mage::app()->getLayout()->getBlock('header')->getWelcome();
}
}
Check http://freegento.com/doc/d7/d92/class_mage___core___model___layout.html#4c2f3ed0733b1d16c6b9d1d13898574f
When the block can't be found, the
getBlockreturnsfalseinstead of an object, and the error is thrown when you try to callgetWelcomeon this.(definition of getBlock in case the link doesn't work):
Add an
ifstatement to check if the block exists before trying to operate on it.