Try our conversational search powered by Generative AI!

Quan Mai
Nov 2, 2018
  1854
(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
Azure AI Language – Extractive Summarisation in Optimizely CMS

In this article, I demonstrate how extractive summarisation, provided by the Azure AI Language platform, can be leveraged to produce a set of summa...

Anil Patel | Apr 26, 2024 | Syndicated blog

Optimizely Unit Testing Using CmsContentScaffolding Package

Introduction Unit tests shouldn't be created just for business logic, but also for the content and rules defined for content creation (available...

MilosR | Apr 26, 2024

Solving the mystery of high memory usage

Sometimes, my work is easy, the problem could be resolved with one look (when I’m lucky enough to look at where it needs to be looked, just like th...

Quan Mai | Apr 22, 2024 | Syndicated blog

Search & Navigation reporting improvements

From version 16.1.0 there are some updates on the statistics pages: Add pagination to search phrase list Allows choosing a custom date range to get...

Phong | Apr 22, 2024