I'm trying to create a custom report in the Magento back-end; my strategy is to first make my new module mimic the existing Reports/Sales/Orders functionality in the admin panel, and then make the required changes once I've seen how the pieces fit together. I've added my new menu item, and the module loads the basic admin layout and some breadcrumbs, so the module config and controller config are set up properly enough. However, layout blocks aren't loading. Here's the problem code. Assume that I have a copy of the relevant block file at app/code/local/BULX/Reports/Block/Report/Sales/Sales/Grid.php:
class BULX_Reports_IndexController extends Mage_Adminhtml_Report_SalesController {
public function salesAction {
//...otherwise identical to parent class
//should load reference to Grid block
$gridBlock = $this->getLayout()->getBlock('report_sales_sales.grid');
/* in original Mage module, will output Mage_Adminhtml_Block_Report_Sales_Sales_Grid
in BULX_Report, outputs nothing. */
echo get_class($gridBlock)."<br>";
My config file has
<global>
<blocks>
<bulx_reports>
<class>BULX_Reports_Block</class>
</bulx_reports>
</blocks>
...
</global>
If I change the code to
$gridBlock = $this->getLayout()->getBlock('bulx_reports/test');
with the following file at app/code/local/BULX/Reports/Block/Test.php
class BULX_Reports_Block_Test extends Mage_Core_Block_Abstract
{
protected function _toHtml() {
echo 'to html';
}
}
I get the same result: no 'to html' output, no output from the get_class call
I added log statements as suggested here: http://www.fontis.com.au/blog/magento/magento-debugging-loading-blocks-layouts-and-config-files
and it's clear from that Magento isn't finding any layout blocks in my new module. Alan Storm's tutorials are usually incredibly helpful, but I'm not finding what I need in alanstorm.com/magento_admin_controllers (sorry not enough reputation to have two hyperlinks); as far as I can tell, I've set up my configuration identically. A difficulty is that the 'report_sales_sales.grid' string doesn't appear anywhere-those Grids appear in lots of places in the admin, and they get built dynamically by a structure that I haven't found.
What am I missing? This is Enterprise Edition, 1.8. Thanks!