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 Answer 1

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');
}
4
  • thanks for your answer,then how to echo this to admin view file
    – Tush
    Jul 23, 2016 at 13:43
  • echo $this->getLayout()->createBlock('compatibility/compatibilityblock')->toHtml() Jul 23, 2016 at 13:49
  • I did that way but not display the content of that block
    – Tush
    Jul 23, 2016 at 13:52
  • add a die or something in the constructor to be sure that the code there is being executed Jul 23, 2016 at 14:12

Your Answer

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

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