0

I receiving this error:

Fatal error: Uncaught Error: Call to a member function toHtml() on boolean in ...

This is how my block is declared:

    <blocks>
        <emailtester>
            <class>Yireo_EmailTester_Block</class>
        </emailtester>
    </blocks>

This is my block from where the error occurs:

 class Yireo_EmailTester_Block_Form extends Mage_Adminhtml_Block_Widget_Container
 {
...

    protected function _toHtml()
    {
        $this->setChild('check', $this->getCheckBlock());
        $rt = parent::_toHtml();
        return $rt;
    }


    protected function getCheckBlock()
    {
        return Mage::app()->getLayout()->createBlock('emailtester/form_check')->setId('check');
     //   return $this->getLayout()->createBlock('emailtester/form_check')->setId('check');
    }

Whatever string I type instead of emailtester/form_check I still get this error message. Any idea what could cause this issue? thank you in advance for any idea

1 Answer 1

0

Somewhere in the code Magento tries to render the block by calling toHtml() on the block, which is a standard function for rendering Blocks in Magento. But your block isn't called properly, so it's boolean false which obviously does not have a method toHtml

3
  • This is block: emailtester/form_check. See my block declaration in the xml. I have the folder Form and my file Check.php . I put in the constructor from Check.php and echo 1; exit(). I didn't get it. I don't know what else should i check. thx :) Commented Jan 5, 2017 at 13:59
  • Have you added your block in the layout?
    – Jacques
    Commented Jan 5, 2017 at 14:03
  • I updated my post, could you pleas check it ? txh Commented Jan 6, 2017 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.