Get Free Audit

How to Create Custom Reports Based on Statistics Module in Prestashop

Nov 14, 2014

1793 Alex Simonchik

How to Create Custom Reports Based on Statistics Module in Prestashop

In this article we will explain how to create a statistics module (the module is avaliable at the end of the article).

Such types of modules are available under the tab Bасkend-> Stаts-> Stаts:

1_How to Create Custom Reports Based on Statistics Module in Prestashop

 

This page is generated by the controller “AdminStatsController”, which is inherited from the controller “AdminStatsTabController”. The latter uses the method “protected function getMоdules()” to send the following request to determine which modules are related to the statistics:


Once one of our customers asked to generate the following type of report:

is it possible to make a report in prestashop that shows how many new products are created by category and by employee (they log on with the own login).

That is why to help him we created this module.

There are 2 methods (for standard modules) to implement this type of modules:

  1. Inherit from the class Module
  2. Inherit from the class ModuleGrid

In the second way you should implement the abstract method getData() where to implement the logic to get entries for the statistics. Basically, the second method presupposes that there should be a specific list, while the first method allows us output data just the way we want.

The module with the class MоduleGrid is similar to the admin controller, that with the help of the method  ‘public function engine( $params)’ generates HTML with results in the form of a table.

2_How to Create Custom Reports Based on Statistics Module in Prestashop

Here is the example of the code of one of our statistics modules:

Andrey_Dubina
Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Andrey


Download the module

prestashop themes

PrestaShop Templates

Take your online store to the next level with BelVG PrestaShop Templates

Visit the page
Andrey Dubina
Partner With Us Looking for a partner to grow your business? We are the right company to bring your webstore to success. Talk to Andrey

2 Comments

  1. Hi, Mike!
    Glad that you liked my tutorial. As you can see, it dates back to year 2014, so I or some other author from BelVG will soon write the updated version of this article. Stay tuned!

  2. Hi dude, nice tutorial, but you should relaod the files, use a github or a girlab or something

    keers!

Post a new comment

BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *