when i create block and insert like this,

$block = $this->getLayout()->createBlock('Mage_Core_Block_Template', 'reviewfororderproducts',array('template' => 'clarion/review.phtml '))->setData('data', $data);

it works fine $block->toHtml() returns a string with all html

but when i do like this

 $block = $this->getLayout()->createBlock('Clarion_ReviewReminder_Block_Allproducts', 'reviewfororderproducts',array('template' => 'clarion/review.phtml '))->setData('data', $data);

i can't get the block, $block->toHtml() returns null

my block class is only extends from Mage_Core_Block_Template

class Clarion_ReviewReminder_Block_Allproducts extends Mage_Core_Block_Template
    protected function _construct()
  • Can you share the code from your block? Otherwise you're asking why 1 plus something doesn't equal something else
    – scrowler
    Commented Jun 27, 2016 at 10:33
  • Clarion_ReviewReminder_Block_Allproducts extends Mage_Core_Block_Template { } Commented Jun 27, 2016 at 10:37
  • If that's the only difference then why do you need it?
    – scrowler
    Commented Jun 27, 2016 at 10:37
  • i don't have any code inside that Commented Jun 27, 2016 at 10:38
  • @RobbieAverill i was having some functions, for debugging i deleted all the functions , Commented Jun 27, 2016 at 10:39

1 Answer 1


If you don't have any custom code in your custom block and that block only extends Mage_Core_Block_Template there is no point using a custom block.

It is not bad practice to use Mage_Core_Block_Template whenever you need to use a template.

Debugging steps

I suggest you start in the toHtml method from Mage_Core_Block_Abstract.

Most of the time, empty HTML is caused by the fact that the module output is disabled in the backend but I don't think it's the case for you as you said it was returning null.

I suggest you add the following code in this method:

if ($this insteanceof Clarion_ReviewReminder_Block_Allproducts) {

Also add some logs to the _toHtml method of Mage_Core_Block_Template as weel as the fetchView method.

  • i will add some custom function in future , for now i have deleted all the functions to debug Commented Jun 27, 2016 at 10:57
  • @rephael i m debugging now Commented Jun 27, 2016 at 10:59
  • @manokarthickkarthick see my edit for debugging Commented Jun 27, 2016 at 11:03

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.