Thursday, 31 October 2019

clear smarty cache automatically in prestashop

The script should work assuming you place the script in the root folder of your store

<?php

require(dirname(__FILE__).'/config/config.inc.php');

//change 'abc123' to any value you wish to use
$token = Tools::getValue('token');
if (!$token || $token != 'abc123')
     die();

Tools::clearSmartyCache();
Tools::clearXMLCache();
Media::clearCache();
PrestaShopAutoload::getInstance()->generateIndex();


Then create a new cronjob that would execute your php script at the interval you desire, and you can test this from a browser to ensure it works properly


No comments:

Post a Comment