Magento module to change dashboard graph

Magento module to change dashboard graph

August 26, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento module to change dashboard graph

Solving Dashboard Graph Issues in Magento: A Comprehensive Guide

If you’re facing issues with your Magento dashboard graph not reflecting certain sales data correctly, you’ve come to the right place! In this post, we’ll dive into a common problem faced by many Magento users and provide a step-by-step solution using an existing community contribution. Let’s get started!

The Challenge: Missing Sales Data on Dashboard Graph

You’re following along with the StackOverflow guide to modify your Magento dashboard graph. You’ve created the necessary files, placed them in the correct directories, and enabled the module through the configuration. However, you’re still not seeing the desired results.

The Symptoms

The revenue total on the dashboard appears to be accurate, but it’s not reflected properly on the timeline graph. For example, a net 30 terms order of $2000 at 10AM doesn’t show up in the time graph as expected. This discrepancy can be quite frustrating, especially when you’ve followed all the steps correctly.

The Files in Question

Before we proceed with the solution, let’s take a closer look at the provided files:

CaitlinHavener/Dashboard/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <CaitlinHavener_Dashboard>
            <version>1.0</version>
        </CaitlinHavener_Dashboard>
    </modules>
    <global>
        <models>
            <CaitlinHavener_Dashboard>
                <class>CaitlinHavener_Dashboard_Model</class>
            </CaitlinHavener_Dashboard>
            <reports_resource>
                <rewrite>
                    <order_collection>CaitlinHavener_Dashboard_Model_Reports_Resource_Order_Collection</order_collection>
                </rewrite>
            </reports_resource>
        </models>
    </global>
</config>

CaitlinHavener/Dashboard/Model/Reports/Resource/Order/Collection.php

<?php
/**
 * Show all orders, not only the invoiced one
 */
class CaitlinHavener_Dashboard_Model_Reports_Resource_Order_Collection extends Mage_Reports_Model_Resource_Order_Collection
{
    // Rest of the code...
}
?>

The Solution: Modifying the Order Collection

The issue lies within the CaitlinHavener/Dashboard/Model/Reports/Resource/Order/Collection.php file. To resolve this, we need to modify the prepareSummaryLive() and calculateTotalsLive() functions accordingly.

Step 1: Update the prepareSummaryLive() Function

In the prepareSummaryLive() function, update the following lines:

// ...
$expression = sprintf('%s - %s - %s - (%s - %s - %s)',
    $adapter->getIfNullSql('main_table.base_total_invoiced', 'main_table.base_grand_total'),
    $adapter->getIfNullSql('main_table.base_tax_invoiced', 'main_table.base_tax_amount'),
    $adapter->getIfNullSql('main_table.base_shipping_invoiced',  'main_table.base_shipping_amount'),
    $adapter->getIfNullSql('main_table.base_total_refunded', 0),
    $adapter->getIfNullSql('main_table.base_tax_refunded', 0),
    $adapter->getIfNullSql('main_table.base_shipping_refunded', 0)
);
// ...

Step 2: Update the calculateTotalsLive() Function

In the calculateTotalsLive() function, update the following lines:

// ...
$baseTotalInvoiced = $adapter->getIfNullSql('main_table.base_total_invoiced', 'main_table.base_grand_total');
$baseTaxInvoiced = $adapter->getIfNullSql('main_table.base_tax_invoiced', 'main_table.base_tax_amount');
$baseShippingInvoiced = $adapter->getIfNullSql('main_table.base_shipping_invoiced', 'main_table.base_shipping_amount');
// ...

The Final Touches

After making these changes, don’t forget to:

  1. Save the updated Collection.php file.
  2. Clear Magento cache: Go to System > Cache Management and click “Flush Magento Cache”.
  3. Reindex your data: Go to System > Index Management and reindex all the indices.
  4. Refresh lifetime statistics: Go to Reports > Sales > Lifetime Statistics and click “Refresh”.

Why This Solution Works

The provided solution addresses the issue by ensuring that the dashboard graph considers all relevant orders, not just those with invoices attached. By modifying the order collection’s behavior, we can now display sales data from processing orders on the timeline graph.

Conclusion: A Fresh Perspective on Dashboard Graphs

In this post, we’ve explored a common Magento issue regarding missing sales data on the dashboard graph. Through an in-depth analysis of the provided files and functions, we were able to identify the root cause of the problem and provide a clear solution.

By following the steps outlined above, you should now be able to successfully modify your Magento dashboard graph to reflect all relevant sales data, including processing orders. This will help you gain a more accurate representation of your store’s performance.

Remember, when working with Magento customizations, it’s essential to keep track of file paths and version compatibility. If you’re unsure about any aspect of the process, don’t hesitate to consult our Magento development services or seek guidance from experienced developers in the community.

Happy coding!

Extensions Configuration Orders Errors

Our network