webbynz Posted November 19, 2013 Share Posted November 19, 2013 Hi, I have a website where prices are updated for all products twice daily. What I'm looking to do is clear the cache of the front page, as it displays prices for some featured items and if the cache is not cleared, when you click one of the products, the price differs to that on the product page. I assume it can be done, I just haven't a clue how and would really appreciate some help! Many thanks Ryan Link to comment Share on other sites More sharing options...
NemoPS Posted November 20, 2013 Share Posted November 20, 2013 You mean running the same function prestashop runs when you hit 'clear smarty cache' in the back office? Link to comment Share on other sites More sharing options...
webbynz Posted November 20, 2013 Author Share Posted November 20, 2013 Hey, yeah that's exactly what I'm trying to automate. Cheers Link to comment Share on other sites More sharing options...
NemoPS Posted November 20, 2013 Share Posted November 20, 2013 Try adding this to the file you call (be sure you include the config headers first) Tools::clearSmartyCache(); Link to comment Share on other sites More sharing options...
webbynz Posted November 20, 2013 Author Share Posted November 20, 2013 Thanks for the information - I'm a complete newbie to cron jobs and have only ever set them up when the command has been provided. I don't actually understand what I need to do (sorry!). Any chance you could provide me with some details, or point me to somewhere I could learn?Many thanks in advance Ryan Link to comment Share on other sites More sharing options...
NemoPS Posted November 20, 2013 Share Posted November 20, 2013 Sure, here is an article about them http://net.tutsplus.com/tutorials/other/scheduling-tasks-with-cron-jobs/?search_index=1 But if you use cpanel, you can easily set them up using the builtin tools, where you basically only have to select the time period with dropdown menus, and link the script you want to call Link to comment Share on other sites More sharing options...
webbynz Posted November 20, 2013 Author Share Posted November 20, 2013 Thanks a lot, I think I understand how to create via CPanel, as have done this before, it's more the script that I need the help with. Link to comment Share on other sites More sharing options...
NemoPS Posted November 20, 2013 Share Posted November 20, 2013 Oh, sorry! In this case, before calling that method in your php file, be sure you include this include(dirname(__FILE__).'config/config.inc.php'); include(dirname(__FILE__).'init.php'); BUT! depending on where you place your script, refer to the inclusions correctly Those are the settings to apply if your file sits in prestashop's root folder Link to comment Share on other sites More sharing options...
webbynz Posted November 20, 2013 Author Share Posted November 20, 2013 Hi again, really thanks for your help but i'm not getting far...... Can you tell me what the entire contents of the .php file would be that I will need to create? Link to comment Share on other sites More sharing options...
NemoPS Posted November 20, 2013 Share Posted November 20, 2013 Sure <?php include(dirname(__FILE__).'config/config.inc.php'); include(dirname(__FILE__).'init.php'); Tools::clearSmartyCache(); Should work, but i haven't tested it. Link to comment Share on other sites More sharing options...
webbynz Posted November 20, 2013 Author Share Posted November 20, 2013 OK simple as that. Brilliant, thanks heaps! Link to comment Share on other sites More sharing options...
J.Sahu Posted January 24, 2014 Share Posted January 24, 2014 Please Mark your thread as solved. Just edit the first post of your, use full screen editor and add [solved] before your topic text Link to comment Share on other sites More sharing options...
guillenqn Posted February 19, 2014 Share Posted February 19, 2014 Is it possible to create a Cron Task to automate this process? What should the URL look like? Link to comment Share on other sites More sharing options...
bbouhuis Posted May 20, 2014 Share Posted May 20, 2014 Is it possible to create a Cron Task to automate this process? What should the URL look like? And do you already have a sample URL. I would like to have a URL also Link to comment Share on other sites More sharing options...
lateral Posted October 17, 2014 Share Posted October 17, 2014 I'd also like to use the inbuilt Prestashop Cron Job module to automate the clearing of Smarty Cache.... Link to comment Share on other sites More sharing options...
geochrist Posted October 24, 2014 Share Posted October 24, 2014 Hi This is an issue that is important to many of us. I understand that you have to make a php file with the above content. Then what? 1.Where do we copy it on our site 2. How to make an absolute secure url reference to feed prestashops cron module? Thank you George Link to comment Share on other sites More sharing options...
NemoPS Posted October 24, 2014 Share Posted October 24, 2014 I would store it inside a module's folder, hardcode some kind of hashed token, then uset a GET to verify it's also passed when calling the cron url Link to comment Share on other sites More sharing options...
Recommended Posts