Try our conversational search powered by Generative AI!

Quan Mai
Nov 2, 2018
  1862
(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
From Procrastination to Proficiency: Navigating Your Journey to Web Experimentation Certification

Hey there, Optimizely enthusiasts!   Join me in celebrating a milestone – I'm officially a certified web experimentation expert! It's an exhilarati...

Silvio Pacitto | May 17, 2024

GPT-4o Now Available for Optimizely via the AI-Assistant plugin!

I am excited to announce that GPT-4o is now available for Optimizely users through the Epicweb AI-Assistant integration. This means you can leverag...

Luc Gosso (MVP) | May 17, 2024 | Syndicated blog

The downside of being too fast

Today when I was tracking down some changes, I came across this commit comment Who wrote this? Me, almost 5 years ago. I did have a chuckle in my...

Quan Mai | May 17, 2024 | Syndicated blog

Optimizely Forms: Safeguarding Your Data

With the rise of cyber threats and privacy concerns, safeguarding sensitive information has become a top priority for businesses across all...

K Khan | May 16, 2024