Jump to content

function delete


EricGardien

Recommended Posts

Hello,

 

In my module I have a public function install(), uninstall(), enable() and disable() working well when the respective link is pressed from the module administration page.

 

In the same way, I would like to have a function called when the link Delete is called.

 

Could somebody help me with that ?

 

I tried the same as in my function public enable() but it is not working.

 

 

public function delete()

{

if (!parent::delete()

OR !...

)

return false;

return true;

}

 

public function enable()

{

if (!parent::enable()

OR !...

)

return false;

return true;

}

 

 

Thank you very much

Link to comment
Share on other sites

Hello Richard,

 

I need to know when the module is deleted and send this information to another website which show the logo of the shop.

If the module is uninstalled, the logo of the shop must not appear anymore (this is working)

If the module is deleted, all the information of the shop have to be deleted. (not working)

 

It seems that the logic of module deletion do not uninstall it before.(strange no ?)

It would be a less problem if function uninstall was fired before the module deletion.

Link to comment
Share on other sites

Yeah, it would be, however there are not this kind of functionality and there is no such function delete() in module class. When you press delete in your Modules BO tab, PrestaShop will only delete every files from the hard drive and that's all. You could add your custom functionality to /admincatalog/tabs/AdminModules.php function public function recursiveDeleteOnDisk($dir). As I see it is only used to delete modules, but you should check it before doing something.

Link to comment
Share on other sites

I read in the documentation that indeed the module was uninstalled but when I test it, it's different.

 

I have a uninstall function :

 

 

public function uninstall()

{

if (!parent::uninstall()

 

OR !$this->_websiteActions('uninstall')

OR !Configuration::deleteByName($this->name.'_pi')

OR !Configuration::deleteByName($this->name.'_pp')

)

return false;

return true;

}

 

When the I click on uninstall, the variables _pi and _pp are deleted.

When I delete the module without uninstalling it, both variables remain in the system, and _websiteActions('uninstall') is not executed.

 

If I add the module again, the variables _pi and _pp are still valid.

 

So it seems that the function uninstall is not execute before the module is deleted.

Do you have an idea why ?

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