Jump to content

How to force smarty cache to be cleanned


Recommended Posts

Hi everybody,

 

Is there any way of forcing the smarty cache to be cleanned without having to do any action in the PrestaShop BackOffice.

 

I'm integrating my ERP with PrestaShop using the Web Service, and I found a way of configuring the items in the Horizontal Top Menu module making a REST request over configuration table (where the items are defined).

But the problem is that the menu is not refreshed in the main page, because the previous menu is cached. If I access the Horizontal Top Menu configuration module I can see it configured with the items I set with the WS request, and if I click on Save button the previous menu is removed (because smarty cache is cleanned). But I don't want to access the BackOffice because I want to manage the menu from my ERP (using the Web Service).

 

Can anyone help me?

 

Thanks in advance

Link to comment
Share on other sites

Try with Tools::clearCache();

First of all, Thank you very much!

 

I'm sorry it doesn't fit to me because this solution implies to invoke an action in the server-side, and I need to invoke from the Web Service (client-side). I'm figuring out it's not possible to do what I need.

 

Thanks again!

Link to comment
Share on other sites

Well you can try creating your own third-party accessible script to launch it, like create a separate file on the server, include a security token check and presta's config (see any ajax.php file like blocklayered's) and then call that method :)

Link to comment
Share on other sites

Well you can try creating your own third-party accessible script to launch it, like create a separate file on the server, include a security token check and presta's config (see any ajax.php file like blocklayered's) and then call that method :)

 

I'm new on PrestaShop, and also in php. Please, would you mind to detail a little more you solution?

Thanks!!

Link to comment
Share on other sites

Well there is a little chance you can do it on your own then, I will be honest. You absolutely need to know both, but especially php. Try something like this

include(dirname(__FILE__).'/../../config/config.inc.php');
include(dirname(__FILE__).'/../../init.php');

Tools::clearCache();

Please note this is supposed to be in a module's folder, adjust paths depending on the file location

Link to comment
Share on other sites

×
×
  • Create New...