Magento Admin Custom Sales Report

Posted by Ela on Stack Overflow See other posts from Stack Overflow or by Ela
Published on 2010-12-21T11:50:18Z Indexed on 2010/12/21 11:54 UTC
Read the original article Hit count: 271

Filed under:
|

Hi,

I have to develop a module to export collection of product,order,customer combined attributes. So i thought rather than modifying the core sales report for this purpose better to do a custom functionality. These are the steps that i did but i am not able to produce it. Used magento 1.4.1 version for this.

Under /var/www/magento141/app/code/core/Mage/Reports/etc/adminhtml.xml Added these lines for menus.

           <ereaders translate="title" module="reports">
                <title>EReader Sales Report</title>                  
                 <children>
            <ereaders translate="title" module="reports">
                        <title>Sales Report</title>
                        <action>adminhtml/report_sales/ereaders</action>
                    </ereaders>
                </children>                                    
            </ereaders>

Under

/var/www/magento141/app/design/adminhtml/default/default/layout/sales.xml Added these lines for filter condition.

<adminhtml_report_sales_ereaders>
    <update handle="report_sales"/>
    <reference name="content">
        <block type="adminhtml/report_sales_sales" template="report/grid/container.phtml" name="sales.report.grid.container">
            <block type="adminhtml/store_switcher" template="report/store/switcher/enhanced.phtml" name="store.switcher">
                <action method="setStoreVarName"><var_name>store_ids</var_name></action>
            </block>
            <block type="sales/adminhtml_report_filter_form_order" name="grid.filter.form">
               ----
            </block>
        </block>
    </reference>
</adminhtml_report_sales_ereaders>

And then copied the needed block,model files from sales and renamed all of them into ereaders under /var/www/magento141/app/code/core/Mage/Adminhtml/.

Then placed action for ereaders under /var/www/magento141/app/code/core/Mage/Adminhtml/controllers/Report/SalesController.php

public function ereadersAction()
{
$this->_title($this->__('Reports'))->_title($this->__('Sales'))->_title($this->__('EReaders Sales'));

    $this->_showLastExecutionTime(Mage_Reports_Model_Flag::REPORT_ORDER_FLAG_CODE, 'ereaders');

    $this->_initAction()
        ->_setActiveMenu('report/sales/ereaders')
        ->_addBreadcrumb(Mage::helper('adminhtml')->__('EReaders Sales Report'), Mage::helper('adminhtml')->__('EReaders Sales Report'));

    $gridBlock = $this->getLayout()->getBlock('report_sales_ereaders.grid');
    $filterFormBlock = $this->getLayout()->getBlock('grid.filter.form');

    $this->_initReportAction(array(
        $gridBlock,
        $filterFormBlock
    ));
    $this->renderLayout();
}

Here when i use var_dump ==> //var_dump($this->getLayout()->getBlock('report_sales_ereaders.grid')); am getting bool(false) only. It does not call the ereaders grid, instead of its still loading blocks and grids from Sales only.

I searched most of the files related to report, am not still able to find out the problem. Hope many of you gone through these sort of issues, please can anyone tell me where am making mistake or missing something.

© Stack Overflow or respective owner

Related posts about magento

Related posts about magento-1.4