So, I switched the template of
order_info to add some more information by adding a child block to it in
adminhtml_sales_order_view. The order account information in the admin is updated correctly, and I see what I added.
<adminhtml_sales_order_view> <reference name="order_info"> <!-- Replace it with my template --> <action method="setTemplate"><template>qwer/sales/order/view/info.phtml</template></action> <!-- Add a child block --> <block type="qwer_sales/adminhtml_sales_order_view_info_ax" name="ax_account_info" template="sdm/sales/order/view/ax.phtml" /> </reference> </adminhtml_sales_order_view>
My custom class below has some additional methods to retrieve what I want.
class QWER_Sales_Block_Adminhtml_Sales_Order_View_Info_Ax extends Mage_Adminhtml_Block_Sales_Order_View_Info
However, when I try to
toHtml() on this child block from a controller action, I get an error saying
Invalid parent block for this block because
null. I'm actually rendering the child block using a layout update as well, but the issue comes down to this - see below.
In a controller action...
$html = $this->getLayout() ->createBlock('qwer_sales/adminhtml_sales_order_view_info_ax') ->setTemplate('qwer/sales/order/view/ax.phtml') ->toHtml();
Any ideas why this is not working and what I need to do to fix it?
Update: Solved it. See my answer.