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.

“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).

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
- Download salesreport.ocmod.zip. Don’t unzip it.
- Go to Extensions > Installer, click Upload and choose the zip.
- Click the green Install button next to “Sales Report Dashboard”.
- Go to Extensions > Extensions and choose Reports from the dropdown. This is a report extension, so it isn’t in the Modules list.
- 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.
- 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?
| Period | Compared with |
|---|---|
| Last 30 or 90 days, custom dates | The same number of days just before |
| This month (to date) | The same days of last month: December 1-2 against November 1-2 |
| Last month | The month before it |
| This year (to date) | Last year up to the same date |
| Last year | The 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.

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.

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_ordertable has no index ondate_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.
Related posts
- How to add reports in the OpenCart 4 admin dashboard
- Export OpenCart 4 orders to CSV and Excel
- GA4 ecommerce tracking in OpenCart 4
- Admin Activity Log for OpenCart 4







