Good evening, I am developing a prestashop module that has to display some data on the head hook by retrieving said data from the DB. I would like to make this data dynamic and update it when it changes in the DB where it is stored. What is the best approach for this? I was thinking of using ajax but can't find any reference on the module development documentation that explains how to implement it.
Thanks, Gustavo.
if this is not any heavy operation you can setup ajax request in time intervals, best would be to create ModuleFrontController for your module and create ajax request to it, more about creating FrontController for your module you will find here: https://devdocs.prestashop.com/1.7/modules/concepts/controllers/front-controllers/
Of course there are some solutions based on websockets but if you're not familiar with this approach you should do a little research first, read about socket.io and other solutions.