Try our conversational search powered by Generative AI!

Quan Mai
Nov 2, 2018
  1860
(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

Comments

Please login to comment.
Latest blogs
Configured Commerce - Infrastructure Updates Ahoy!

I'm very happy to share an important milestone - we no longer have any customers in our legacy v1 environment!  This means that the Configured...

John McCarroll | May 10, 2024

A day in the life of an Optimizely Developer - Enabling Opti ID within your application

Hello and welcome to another instalment of A Day In The Life Of An Optimizely developer, in this blog post I will provide details on Optimizely's...

Graham Carr | May 9, 2024

How to add a custom property in Optimizely Graph

In the Optimizely CMS content can be synchronized to the Optimizely Graph service for it then to be exposed by the GraphQL API. In some cases, you...

Ynze | May 9, 2024 | Syndicated blog

New Security Improvement released for Optimizely CMS 11

A new security improvement has been released for Optimizely CMS 11. You should update now!

Tomas Hensrud Gulla | May 7, 2024 | Syndicated blog