Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

SS_Report and SideReport : how to?

Go to End

6 Posts   2540 Views


Forum Moderator, 435 Posts

6 June 2010 at 1:17am

I tried to create reports, but I don't see any of them.

class DBReport_AquistatiProducts extends SideReport {

function title() {
return "Prodotti Acquistati";

function records() {
return DataObject::get("Product", "Aquistato = 1", "Title");

function fieldsToShow() {
return array(
"Title" => array("NestedTitle", array("2")),

and under mysite/code/reports

class CurrentOrdersReport extends SSReport {

Is there a guideline?
Thank you


Forum Moderator, 5523 Posts

6 June 2010 at 11:49am

In 2.3 these would appear automatically after doing a ?flush=1. In 2.4 you now have to register the reports you want to include in the cms via this line of code in your _config file.

SS_Report::register("SideReport", "SideReport_NameOfReport");


Community Member, 56 Posts

3 September 2010 at 6:04am

Hi Wilr,

I have a class that extends the SS_Report. And I have this module that saves the report in a PDF format, its called DOMPDF module. Now, the thing is I want to create a custom template to render the report. Is this possible? If it is indeed possible, how do I go through this?

Thanks in advance!


Community Member, 3 Posts

11 March 2011 at 12:13pm

This seems to be horrendously underdocumented for something taking up a full tab in the CMS.
The only tutorial I can find is and that's completely out of date.

So what needs to be done to add a report for 2.4?
And is it SideReport or SS_Report now?


Community Member, 102 Posts

15 September 2011 at 4:29am

Edited: 15/09/2011 4:40am

rwestera, I know I'm replying to a months old post and you've probably switched to Drupal by now, but for anyone else trying to do this...

This seems to be horrendously underdocumented for something taking up a full tab in the CMS.


If you use the code as documentation, then you have everything you need.

E.g. See cms/code/reports/BrokenLinksReport.php to see how to write a report. Search all php files for 'BrokenLinksReport' to see how it's utilised.

This report allows users to download a csv of all users in the newsletter group:

class UserReport extends SS_Report {

	function title() {
		return 'Users';

	function sourceRecords($params, $sort, $limit) {

		return DataObject::get(
				, "`Group`.`code`='newsletter'"
				, $sort
				, "inner join group_members on = group_members.MemberId inner join `group` on group_members.GroupId = `group`.id"
				, $limit

	function columns() {

		$fields = array(
			  'FirstName' => array(
					'title' => 'First name'
			, 'Surname' => array(
					'title' => 'Surname'
			, 'Email' => array(
					'title' => 'Email'

		return $fields;


To register a report in the CMS 'Reports' tab...

SS_Report::register('ReportAdmin', 'UserReport', -19);

I guess the number at the end determines the order they are shown in the menu.

I think...

SS_Report::register("SideReport", "SideReport_NameOfReport"); for reports that appear on the pages tab under 'Site Reports'.

Carbon Crayon

Community Member, 598 Posts

11 October 2011 at 10:44am

There is now an up to date tutorial for adding reports here:

Hope that helps :)