0

If I have a method in my renderer class:

public function render(Varien_Object $row)
{
 $rowValue = $row->getData($this->getColumn()->getIndex());
 $data = unserialize($rowValue);
 $result = '';
 if (is_array($data) && count($data) > 0) {
 foreach ($data as $orderItemData) {
 $result .= $orderItemData['name'] . ' </br>';
 }
 }
 return $result;
}

How can I render a template file here and return it?

asked Aug 11, 2016 at 21:12

1 Answer 1

1

A basic example to point you in the right direction:

public function render(Varien_Object $row)
{
 $block = $this->getLayout()->createBlock('core/template');
 $block->setTemplate('path/to/template.phtml');
 return $block->toHtml();
}

The render function is returning the final html for the column in question so any string you return from this function is valid. And if you need to pass your column object to the newly created block, just add $block->setColumn($this) before calling the ->toHtml() method and the column object will be available to you in your new block.

answered Aug 12, 2016 at 1:40

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.