Magento Admin Custom Sales Report

Magento Admin Custom Sales Report

September 6, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento Admin Custom Sales Report

Creating a Custom Sales Report in Magento

In this post, we’ll walk through the process of developing a custom sales report module for Magento 1 using version 1.4.1. This tutorial assumes you have a good understanding of XML layout files and are familiar with basic Magento development.

Steps to Create a Custom Sales Report

1. Add Menu Entries in adminhtml.xml

Open the adminhtml.xml file located at:

/var/www/magento141/app/code/core/Mage/Reports/etc/adminhtml.xml

Add the following code under the <config> tag:

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

This code creates a new menu entry in the Reports section.

2. Add Layout Updates in sales.xml

Next, open the sales.xml file located at:

/var/www/magento141/app/design/adminhtml/default/default/layout/sales.xml

Add the following lines inside the <adminhtml> tag:

<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>
  </reference>
</adminhtml_report_sales_ereaders>

This code updates the layout to include a new report grid.

3. Copy and Rename Necessary Files

Copy the necessary block, model, and other files from the sales module and rename them to ereaders. Place these under:

/var/www/magento141/app/code/core/Mage/Adminhtml/

Renaming is essential for Magento to recognize your custom report.

4. Add Controller Action

Open the Report/SalesController.php file located at:

/var/www/magento141/app/code/core/Mage/Adminhtml/controllers/Report/SalesController.php

Add the following action method:

public function ereadersAction()
{
    // ... (title and breadcrumb setup)

    $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();
}

This code defines the new ereaders action for your custom sales report.

The Issue and Potential Solutions

The issue you’re facing might be due to a missing or incorrectly named block in your layout file. To debug this:

  1. Make sure the block name in your layout file exactly matches the one called in the controller.
  2. Check if the model and other files have been correctly copied and renamed.

If the problem persists, it could be a caching issue. Try clearing Magento’s cache using the command:

php -f /var/www/magento141/shell/cache.php -- --clear-all

Remember to replace /var/www/magento141 with your actual Magento installation path.

Conclusion

Creating a custom sales report in Magento requires careful modification of layout files and copying of necessary modules. By following the steps outlined above, you should be able to create a new menu entry for your custom ereaders report.

If you’re still experiencing issues or need further assistance with Magento development, feel free to explore our blog at https://laravelcompany.com for more in-depth tutorials and tips.

Magento 1 Extensions Themes Admin

Our network