Opencart extensions free download · 7 min read · Updated

Sales Report Dashboard for OpenCart 4: Sales by Product, Category, Brand or Month vs the Previous Period (Free Extension)

A free report extension for OpenCart 4 with headline numbers, sales by product, category, brand or month, period comparison and CSV export. Totals checked against SQL.

Opencart 4 sales report dashboard

“Which products sold best last month, and is that better or worse than the month before?” OpenCart 4 has a dozen reports, but none of them answers that in one screen. The core Sales Report groups order totals by day, week, month or year, and the Products Purchased report lists products without any comparison. So most store owners export orders to a spreadsheet and build the answer by hand. An OpenCart 4 sales report should do that for you.

The free Sales Report Dashboard adds a report to Reports > Reports with four headline numbers, a table of sales by product, category, brand or month, each row’s share of sales, the change against the previous period and a CSV download. This OpenCart 4 sales report was built and tested on OpenCart 4.1.0.4, and its totals were checked against a direct database query.

Download: salesreport.ocmod.zip (tested on OpenCart 4.1.0.4).

Sales Report Dashboard in OpenCart 4 Reports: tiles for product sales $22,468.25 up 2.7%, 55 orders, 174 units and average order value $492.89, and a table of products with units, orders, sales, share bars and change percentages
Last 30 days by product, compared with the 30 days before.

What the OpenCart 4 sales report shows

  • Four headline numbers: product sales without tax, orders, units sold and average order value, each with its change against the previous period.
  • Sales by product, category, brand or month, sorted by sales, with units, orders, a share bar and the change for each row.
  • Periods: last 30 days, last 90 days, this month, last month, this year, last year, or your own dates.
  • Order statuses: by default the processing and complete statuses from your store settings, the same ones OpenCart counts as sales, or “Complete only”, or any single status.
  • CSV download of every row, which opens in Excel with accents and currency symbols intact.

Install the extension

  1. Download salesreport.ocmod.zip. Don’t unzip it.
  2. Go to Extensions > Installer, click Upload and choose the zip.
  3. Click the green Install button next to “Sales Report Dashboard”.
  4. Go to Extensions > Extensions and choose Reports from the dropdown. This is a report extension, so it isn’t in the Modules list.
  5. Click Install next to Sales Report Dashboard. Core installs reports switched off, but this one switches itself on with sort order 0, so it is first in the list.
  6. Open Reports > Reports and choose Sales Report Dashboard.

Staff need the access permission for extension/salesreport/report/salesreport in System > Users > User Groups to see it. The installer grants it to your own user group.

Reading the report

The headline numbers

Product sales (ex tax) adds up the order line totals: price times quantity, without tax and shipping, before coupons and other order-level discounts. That is the number that adds up across products. Average order value uses the full order total instead, including tax and shipping, because that is what a customer paid per order. The note under the filters says this on the page, so nobody compares the two by mistake.

The line above the tiles always tells you exactly which dates are being compared.

Which period is it compared with?

PeriodCompared with
Last 30 or 90 days, custom datesThe same number of days just before
This month (to date)The same days of last month: December 1-2 against November 1-2
Last monthThe month before it
This year (to date)Last year up to the same date
Last yearThe year before it

Our first version compared “this year” with the same number of days before January 1, which compared 2026 to date with January 30 to December 31, 2025. That is not what anyone means by “compared with last year”, so calendar periods now compare with the matching calendar span:

// Calendar periods compare with the same calendar span (this year to date with last year to the
// same date, last month with the month before). Rolling and custom periods compare with the same
// number of days just before.
switch ($period) {
    case 'this_month':
        $prev_start = $start->modify('first day of last month');
        $prev_end = min($prev_start->modify('last day of this month'), $prev_start->modify('+' . ($days - 1) . ' days'));
        break;
    case 'last_month':
        $prev_start = $start->modify('first day of last month');
        $prev_end = $prev_start->modify('last day of this month');
        break;
    case 'this_year':
    case 'last_year':
        $prev_start = $start->modify('-1 year');
        // 29 February has no match in the year before: 'Y-m-d -1 year' would roll over into March.
        $prev_end = $end->format('m-d') == '02-29' ? $end->modify('-1 year -1 day') : $end->modify('-1 year');
        break;
    default:
        $prev_start = $start->modify('-' . $days . ' days');
        $prev_end = $start->modify('-1 day');
}

The table

“Share %” is each row’s part of product sales in the period, and the bar is scaled to the best-selling row. “Change %” compares the row’s sales with the previous period. A row that sold nothing in the previous period shows a “new” badge instead of an infinite percentage. The screen shows the top 50 rows, and the CSV has all of them.

By month

Grouping by month adds a column chart above the table. The chart is a picture of the same numbers, and the table stays the place to read exact values.

Sales Report Dashboard grouped by month for this year, with a column chart for August to December and a table of units, orders, sales and share per month
This year by month.

By category and brand

Grouping by brand uses the product’s manufacturer, and products without one are grouped as “No brand”. Grouping by category has one catch: OpenCart lets a product sit in several categories, and the report counts its sales in each of them. A MacBook in both “Laptops & Notebooks” and “Mac” adds its sales to both rows, so the category shares can add up to more than 100%. That is the honest answer to “how much did each category sell”, but don’t add the rows together.

Sales Report Dashboard grouped by category for the last 30 days, with Desktops, Laptops and Notebooks and Phones and PDAs at the top
Last 30 days by category.

The CSV file

Download CSV uses the filters on the screen and names the file after them, for example sales-by-category-2026-11-03-to-2026-12-02.csv. Numbers are plain, with a dot as the decimal separator and no currency symbol, so you can sum and chart them straight away. The file starts with a UTF-8 byte order mark so Excel reads names such as “Laptops & Notebooks” or accented product names correctly.

Category,Units,Orders,Sales,"Share %","Previous period","Change %"
Desktops,55,30,18432.96,45.8,16854.92,9.4
"Laptops & Notebooks",19,11,13600.00,33.8,12600.00,7.9
"Phones & PDAs",21,15,2832.96,7.0,4154.92,-31.8

How it works

The report follows the structure of OpenCart’s own report extensions. Reports > Reports loads the extension’s report method into the page. The filter button reloads only the list through a list method, and the CSV comes from a csv method with the same filters. All queries live in one model. This is the product query:

// The name from the order line, so deleted products still show.
$sql = "SELECT op.`product_id` AS id, COALESCE(MAX(pd.`name`), MAX(op.`name`)) AS name, " . $measures . " " . $from . " LEFT JOIN `" . DB_PREFIX . "product_description` pd ON (pd.`product_id` = op.`product_id` AND pd.`language_id` = '" . $language_id . "') WHERE " . $this->where($filter) . " GROUP BY op.`product_id` ORDER BY revenue DESC";

It reads the product name from the order line when the product was deleted later, so old sales of a removed product still show up with their name. Filters from the URL are never put in a query directly: the period, grouping and status are checked against fixed lists, dates are rebuilt with DateTimeImmutable, and status IDs are cast to integers. A request with group=<b> and a broken date simply shows the default report.

What we tested

  • We added 140 demo orders spread over 110 days, with complete, processing and cancelled statuses, and compared the report with a direct SQL query for the last 90 days. Both returned 133 orders, 371 units and $53,076.62. Cancelled orders were left out, as they should be.
  • Custom dates entered the wrong way round, such as November 30 to November 1, are swapped.
  • Each period showed the comparison dates listed in the table above.
  • The demo orders were deleted after the screenshots.

Limitations

  • There is no profit or margin column, because OpenCart 4 has no cost price field.
  • Returns and refunds are not subtracted. An order you refunded but left at “Complete” still counts.
  • All stores are combined. Amounts are in your default currency, which is how OpenCart stores order totals.
  • In 4.1.0.4 the oc_order table has no index on date_added, only on the order ID, email and status. On a store with hundreds of thousands of orders, adding one makes date-filtered reports faster. The Speed Booster post explains how to find slow queries like this.
Rupak Nepali
Written byRupak Nepali

Rupak Nepali is a web developer, manage Webocreation website and the author of six books:
Getting Started with OpenCart Module Development (Packt, 2013),
OpenCart Theme and Module Development (Packt, 2015),
OpenCart 4: Dev Guide for Themes & Extensions (2024),
OpenCart 4: User Manual (2025),
Cloudflare for the Enterprise Website (2026) and
The Technical Web Guide for Marketers (2026).
Rupak has built OpenCart stores and extensions since 2010, has published more than 600 tutorials on Webocreation, and shares free OpenCart extensions on GitHub.
Find Rupak on
GitHub | Amazon | LinkedIn | X | YouTube.

Leave a Reply

Your email address will not be published. Required fields are marked *