DEV Community

Krystian Podemski
Krystian Podemski

Posted on

Better PrestaShop Profiler in version 1.7.8. How to use it in the older versions?

In version 1.7.8 of the PrestaShop returns the ability to collect more precise information about the modules that are displayed on the front office of your store.

Enabling the PrestaShop front office profiler is a great place to start if you need to know more about the performance of your PrestaShop.

The data is collected both for hooks and modules attached to them, but also for widgets. If you don't have PrestaShop 1.7.8, don't worry. The profiler in the new version is very easy to use also with older versions of PrestaShop. In this post I will show you how to use it in the older versions.

I've tested it in PrestaShop 1.7.7, and 1.7.6.

Using the profiler from 1.7.8 in lower versions of PrestaShop

To use profiler in lower versions of PrestaShop, only 4 steps are needed.

  1. First download the PrestaShop 1.7.8 package, you can do it from here.
  2. After unpacking it, copy the tools/profiling folder and move it to the same path in the older PrestaShop version.
  3. Next step is to edit the config/config.inc.php file, just in the place where you currently have this code:
if (_PS_DEBUG_PROFILING_) {
    include_once _PS_TOOL_DIR_ . 'profiling/Controller.php';
    include_once _PS_TOOL_DIR_ . 'profiling/ObjectModel.php';
    include_once _PS_TOOL_DIR_ . 'profiling/Db.php';
    include_once _PS_TOOL_DIR_ . 'profiling/Tools.php';
}
Enter fullscreen mode Exit fullscreen mode

replace it with:

if (_PS_DEBUG_PROFILING_) {
    include_once _PS_TOOL_DIR_ . 'profiling/Profiler.php';
    include_once _PS_TOOL_DIR_ . 'profiling/Controller.php';
    include_once _PS_TOOL_DIR_ . 'profiling/ObjectModel.php';
    include_once _PS_TOOL_DIR_ . 'profiling/Db.php';
    include_once _PS_TOOL_DIR_ . 'profiling/Hook.php';
    include_once _PS_TOOL_DIR_ . 'profiling/Module.php';
    include_once _PS_TOOL_DIR_ . 'profiling/Tools.php';
}
Enter fullscreen mode Exit fullscreen mode

The last step you need to do, is to edit the controllers/admin/AdminLegacyLayoutController.php file and delete:

$this->outPutHtml;

from the end of the display method.

Now if you set _PS_DEBUG_PROFILING_ to true in the config/defines.inc.php, you can use a better version of the profiler in your PrestaShop store.

Summary

All this should give you more information about the health of your front office. You can expect more features available in the front office profiler in the next major version of PrestaShop.

Do you want to know more about the PrestaShop 8, and future of the PrestaShop? Read an article: PrestaShop Beyond 1.7.

PrestaShop front office profiler

Top comments (0)