Jump to content

When installing my module Prestashop tries to copy files in overrides/overrides instead of overrides


zlash

Recommended Posts

I have made a module with a file in the classes folder and when I try to install it it says :

 
Impossible d'installer la surcharge : Ce répertoire doit être modifiable : .../override/override/controllers/admin
 
The funny thing is if I wait for a couple of days it works again until I install/deinstall it.
Is there some cache that is not to be found in the configuration of prestashop??
Link to comment
Share on other sites

Actually if you look closer, there is override two times in the path, which is not normal.

But I figured out that this had somehow to do with the cache, deleting files in the cache and deleting manually all the overrides after uninstalling my module made the trick.

I think that instead of not deleting installed overrides when uninstalling a module prestashop could rename these files, adding the date/time of the uninstallation to it. This way it would be possible to install/uninstall/reinstall a module without having to worry about deleting the overrides manually.

Link to comment
Share on other sites

Prestashop varies on what it does with overrides when removing a module.  What happens if 2 modules override the same class/controller.  If you only uninstall 1 module, what should Prestashop do?

 

Instead of relying on Prestashop to guess correctly, you should construct your override in a way that it detects if your module is installed and enabled, and only then execute the override code.  Otherwise if it is not installed/enabled, then you would only execute the parent function and return, skipping your override logic.  This is the safest way to ensure that the override code is not executed if the override is not removed.

Link to comment
Share on other sites

Thank you for your feedback Bellini, what you suggest sounds great! I will try this. But you raise a question which I have been wondering about indeed and found no answer so far, what happens if 2 different modules override the same controller for example, which one does Prestashop take in account??

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...