How To Add Custom KPI Block In The Prestashop Module

How To Add Custom KPI Block In The Prestashop Module

Are you looking for a step-by-step guide on adding a custom KPI block in the Prestashop module? Here is the complete guide for you, so read on!

Introduction

KPIs (Key Performance Indicators) are the data that showcase how well a company or organization is performing in relation to its objectives. These indicators assist you in taking further steps to better the performance of your e-commerce business.

Key performance indicators are available on various pages in Prestashop’s back-office, such as orders, customer service, customers, and many more. But how to add a custom KPI block in Prestashop needs to be checked.

However, before considering a step-by-step guide, you should learn the basic information. So, let’s begin.

What is Prestashop?

Prestashop is an open-source ecommerce platform written in PHP programming language with MySQL support database management system. This allows you to build a full-fledged online shop with various advanced features. Even you can customize it according to your choices and requirements. However, the settings are very complex and have a beginner-friendly interface, making it suitable for non-technical users.

Why Should You Choose Prestashop?

With the increasing demand for online shopping, the number of ecommerce websites has also increased. Eventually, it gives rise to competition. Thus, to stand apart from the crowd, Prestashop provides several features to empower your business.

Besides, when the business starts growing, its requirements and particular features are changed. Prestashop provides updated modules that you can incorporate to become the best for the owners.

Themes & Modules- Prestashop Customization

There is no doubt Prestashop is a practical approach, but later we will look for advanced features that will help merchants extend their functionalities. The Prestashop’s Modules come in various categories such as product pages, administration, shipping, customers, and many more.

On average, it charges 50 to 100 Euros, which is high in the competitive modules market. However, if you have a limited budget, you can start using its free version with quality outputs.

Now, it’s time to look for steps to create a KPI block.

How To Create KPI Block in the Prestashop Module?

To create a KPI block, you first need to render KPIs or add the render pics() method to the admin controller.

Public function renderKpis()
{ }

Next, you must create an object of HelperKpi class and assign the following property.

Let us consider an example:

For Instance-

Finally, we have created a single KPI and assigned it to the $Kpis array; thus, we need to render this in the admin controller. Here we have generated another object class, HelperKpiRow, and assigned the following properties.

Let us consider an example-

In the last step, you must write an AJAX response, which must be in the following format.

For instance-

That’s all! You can see a KPI blocker appears on the admin controller.

Conclusion

This is easy. Follow the abovementioned steps and create a custom API in PrestaShop without hassle. However, if you’re facing any issues or have doubts in your mind, share with us in the comment box.