1

I want to echo the following block to admin order view page.

echo $this->getLayout()->createBlock('compatibility/compatibilityblock')->setTemplate('tm/compatibility/savequote.phtml')->tohtml();

I have tried the following way but not worked.

echo $block = Mage::app()->getLayout()
->createBlock('compatibility/compatibilityblock')
->setData('area','frontend')
->setTemplate('tm/compatibility/savequote.phtml')->tohtml;
1

You need to set the area data from within the constructor of the block:

public function __construct()
{
    parent::__construct();
    $this->setData('area','frontend');
    $this->setTemplate('tm/compatibility/savequote.phtml');
}
  • thanks for your answer,then how to echo this to admin view file – Tush Jul 23 '16 at 13:43
  • echo $this->getLayout()->createBlock('compatibility/compatibilityblock')->toHtml() – Sari Alalem Jul 23 '16 at 13:49
  • I did that way but not display the content of that block – Tush Jul 23 '16 at 13:52
  • add a die or something in the constructor to be sure that the code there is being executed – Sari Alalem Jul 23 '16 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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