Jump to content

Custom module ( including override ) uninstall


voylinux

Recommended Posts

Hi!

I am developing a custom module por Prestashop wich includes some files that override a couple of Prestashop core classes like ShopCore.

 

I have seen that on install, Prestashop creates a copy of that files in it's own installation /overrides folder. So my question is:

 

How should I indicate in my modules "uninstall" method that those overrides should be eliminated on uninstall?

 

Thank you.

Link to comment
Share on other sites

Hi!

I am developing a custom module por Prestashop wich includes some files that override a couple of Prestashop core classes like ShopCore.

 

I have seen that on install, Prestashop creates a copy of that files in it's own installation /overrides folder. So my question is:

 

How should I indicate in my modules "uninstall" method that those overrides should be eliminated on uninstall?

 

Thank you.

 

this is done by PrestaShop at un-install time.

Link to comment
Share on other sites

you don't say which version of Prestashop you are using... it is possible that PS did not remove the override on uninstall, or it had a defect.

 

Since you cannot guarantee that the override will be uninstalled properly when the module is uninstalled, most authors add logic to their override functions that check if the module is installed/enabled before executing the override functions.

 

You also need to deal with the possibility that the override file is not automatically created.  This could happen if an override of the function already exists. 

Link to comment
Share on other sites

Hi, Bellini13:

 

I can see the override files have been correctly copied during installation.

I am wroking with PrestaShop 5.

 

What kind of login do you suggest I could add to the module to check those things or ensure those files deletion?

Link to comment
Share on other sites

It may work for you, but do not assume it will work for everyone that uses your module.

 

one option is to add a custom function to the override, and then try to execute the function, or check if the function exists.  if it fails, or does not exist, then the override did not copy properly

 

another option is to include some random string in the override... like "a89a7s987asd98a7sd".  Then your module should check if this string exists

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