Jump to content

How to Clear cache when an order is placed?


Recommended Posts

Hi there, I'm using prestashop v 1.6.0.14.

I would like to know how I can go about automating a clearance of the cache every time an order is placed.

I'm not too sure what controller I would need to edit, and I'm guessing it would involve the Tools::clearSmartyCache() function. If someone could point me in a direction, that would be great.

The long version of this story is:

I have created an sql trigger so that when a product has a qty of 0, its visibility changes from everywhere to nowhere.

This trigger works great. The only problem is that the homefeatured module on the home page doesn't update and still shows out of stock products. If I clear the cache in BO, it updates.

 

I have looked into editing this module so that it doesn't use the cache, but with no luck. I figure the simplest solution would be to implement an automated clearance of the cache every time an order is placed.

 

Any help would be greatly appreciated.

Thanks in advance.

 

Link to comment
Share on other sites

the proper way to do this would be to create your own module that registers the "new order" hook, I believe its called actionvalidateOrder.

 

Your modules hookactionvalidateOrder function could then execute the clear cache function.  Prestashop does allow you to clear a specific file from the cache, however I do not know if PS v1.6.0.14 had this feature or not.

Link to comment
Share on other sites

Thank you for your suggestions. I'm not too fussed about the proper way  - I was hoping of just inserting a clear cache function into a controller php file somewhere.

Is there a specific script that deals with the validation of an order?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...