EricGardien Posted January 20, 2012 Share Posted January 20, 2012 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 More sharing options...
Richard S Posted January 21, 2012 Share Posted January 21, 2012 I am afraid, but there is not function such as delete at least in 1.4.6.2. What do you want to do with this function and why do not you implement all the logic for delete to uninstall function? Link to comment Share on other sites More sharing options...
EricGardien Posted January 21, 2012 Author Share Posted January 21, 2012 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 More sharing options...
Richard S Posted January 21, 2012 Share Posted January 21, 2012 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 More sharing options...
EricGardien Posted January 24, 2012 Author Share Posted January 24, 2012 Ok Thank you. But I don't want to change any files of Prestashop. I still find strange that when a module is erased, it is not first uninstalled. Don't you ? Link to comment Share on other sites More sharing options...
Richard S Posted January 24, 2012 Share Posted January 24, 2012 It is. Everything is in uninstall() function. Link to comment Share on other sites More sharing options...
EricGardien Posted January 31, 2012 Author Share Posted January 31, 2012 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 More sharing options...
CartExpert.net Posted January 31, 2012 Share Posted January 31, 2012 Hello, It is just the way it has been coded. You'd need to ask the developer that question. If you necessarily need to execute the uninstall function you will need to edit core files. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now