Quan Mai
Nov 2, 2018
(3 votes)

New reporting features [Beta]

Commerce 12.11, releasing earlier next week, comes with a new type of report: order summary, group by market, currency, and day, to give the site owners an overview of how well their site is performing:

You can now go to the CMS Admin view, which has a new scheduled job "Collect Report Data", which gather the order data and write them to the data warehouse. You then can access to <yoursitehost>/<yoursecretpath>/Commerce/Report#context=epi.commerce.report:///salesbydayreport to get the report by days.

What if you want write your own implementation

The default report generator uses the standard order abstraction APIs so it should work with any implementation. But if you want to have more control on how the data is generated, it is possible by implementing IReportDataGenerator

    public interface IReportDataGenerator
        /// <summary>
        /// Generates line item report data.
        /// </summary>
        /// <param name="fromDate">The start date to generate lineitem reports for.</param>
        /// <param name="toDate">The end date to generate lineitem reports for.</param>
        /// <returns>A collection of line item report model.</returns>
        IEnumerable<LineItemStoreModel> GenerateLineItemReportData(DateTime fromDate, DateTime toDate);

        /// <summary>
        /// Generates order report data.
        /// </summary>
        /// <param name="fromDate">The start date to generate order reports for.</param>
        /// <param name="toDate">The end date to generate order reports for.</param>
        /// <returns>A collection of order report model.</returns>
        IEnumerable<OrderStoreModel> GenerateOrderReportData(DateTime fromDate, DateTime toDate);

which basically has two methods: one to generate line item report data and one to generate order report data for a specified period.

Then register it in one of your initialization modules.

Just give me performance

If you 

  • Are using the default implementation of order system (i.e. PurchaseOrder)
  • Want the fastest possible performance
  • ...without writing too much code yourself

then I have good news for you. We included a second implementation of IReportDataGenerator which takes advantages of internal implementation. If you want the fastest performance, then just add it to one of your initialization modules. For example, in QuickSilver SiteInitialization.ConfigureContainer:

services.AddSingleton<IReportDataGenerator, DirectAccessReportDataGenerator>();

The performance gain is reported between 8 to 15 times faster than the default implementation. But remember the limitations!

This is beta feature and the APIs are subjected to change without a major version, so please consider before using it for production. We also welcome all kind of feedback, bug reports and feature requests for the new repoting system. 

Nov 02, 2018


Please login to comment.
Latest blogs
Plug-in manager is back in CMS 12

Plug-in manager is back in the UI, what is it and how can i use it?

Luc Gosso (MVP) | Oct 6, 2022 | Syndicated blog

Display Child Pages in Content Delivery API Response

The below example will implement an instance of IContentConverterProvider to customise the serialisation of PageData and output child pages in the...

Minesh Shah (Netcel) | Oct 4, 2022

Bring the Report Center back in Optimizely CMS 12

The Report Center has been a part of Optimizely CMS since its first debut in version 5R2 in 2008, but in CMS 12, it's removed! Don't despair! Make...

Tomas Hensrud Gulla | Oct 4, 2022 | Syndicated blog

Customizing Property Lists in Optimizely CMS

Generic property lists is a cool editorial feature that has gained a lot of popularity - in spite of still being unsupported (officially). But if y...

Allan Thraen | Oct 2, 2022 | Syndicated blog

Optimizely names Luminary Senior Developer, Ynze Nunnink, OMVP

Luminary Senior Developer and Optimizely Lead, Ynze Nunnink has secured the coveted position of Optimizely MVP. Earning a Platinum badge for his...

Ynze | Oct 2, 2022 | Syndicated blog

Content Delivery API – The Case of the Duplicate API Refresh Token

Creating a custom refresh provider to resolve the issues with duplicate tokens in the DXC The post Content Delivery API – The Case of the Duplicate...

David Lewis | Sep 29, 2022 | Syndicated blog