Crezzur.com Posted August 21, 2015 Share Posted August 21, 2015 Hey all, I'm upgrading my module to PSR-2 standards as prestashop requires it from there developers but this doesn't apply for the own work ... As you can see on the image below I'm having 2 errors using the module validator from prestashop. Now I'm struggling with 2 errors. ( The red one means i need to add brackets to the "if" function but when i do this my reset function of my module becomes broken en doesn't reset my module anymore. (see code below) Code needed for inline control error: public function uninstall($delete_params = true) { if (!parent::uninstall()) return false; if ($delete_params) if (!$this->uninstallDB()) return false; return true; } The yellow warning means I'm including a helper to my page like this: "require_once(_PS_ROOT_DIR_ . '/modules/DataSheetPro/DspHelper.php');" I need the file so i'm not able to delete is so what are my options ? Hopes someone can help me out of this struggle! Thanks in advance! Link to comment Share on other sites More sharing options...
shacker Posted August 28, 2015 Share Posted August 28, 2015 the warning can be bassed, for the red ones, add the brakets and a extra else public function uninstall($delete_params = true){if (!parent::uninstall()){return false;} else{if ($delete_params)if (!$this->uninstallDB())return false; elsereturn true; }} and the other ones brackets too Link to comment Share on other sites More sharing options...
Crezzur.com Posted September 2, 2015 Author Share Posted September 2, 2015 (edited) the warning can be bassed, for the red ones, add the brakets and a extra else public function uninstall($delete_params = true) { if (!parent::uninstall()){ return false;} else{ if ($delete_params) if (!$this->uninstallDB()) return false; else return true; } } and the other ones brackets too I used the code you added above but it did not work (still same error in presta validator) This code gives me a error in back office: public function uninstall($delete_params = true) { if (!parent::uninstall()) { return false; } else { if ($delete_params) { if (!$this->uninstallDB()) { return false; } else { return true; } } } } Error back-office: Parse error: syntax error, unexpected '{', expecting function (T_FUNCTION) in /home/dezwaluw/public_html/demo/store_4/classes/module/Module.php(2637) : eval()'d code on line 6 Fatal error: Uncaught exception 'ReflectionException' with message 'Class CompareControllerOverrideOriginal_remove55e73f55d7e87 does not exist' in /home/dezwaluw/public_html/demo/store_4/classes/module/Module.php:2638 Stack trace: #0 /home/dezwaluw/public_html/demo/store_4/classes/module/Module.php(2638): ReflectionClass->__construct('CompareControll...') #1 /home/dezwaluw/public_html/demo/store_4/classes/module/Module.php(2482): ModuleCore->removeOverride('CompareControll...') #2 /home/dezwaluw/public_html/demo/store_4/classes/module/Module.php(595): ModuleCore->uninstallOverrides() #3 /home/dezwaluw/public_html/demo/store_4/modules/DataSheetPro/DataSheetPro.php(61): ModuleCore->uninstall() #4 /home/dezwaluw/public_html/demo/store_4/controllers/admin/AdminModulesController.php(519): DataSheetPro->uninstall() #5 /home/dezwaluw/public_html/demo/store_4/controllers/admin/AdminModulesController.php(1089): AdminModulesControllerCore->postProcessReset() #6 /home/dezwaluw/public_html/demo/store_4/classes/controller/Controller.p in /home/dezwaluw/public_html/demo/store_4/classes/module/Module.php on line 2638 [PrestaShop] Fatal error in module file :/home/dezwaluw/public_html/demo/store_4/classes/module/Module.php: Uncaught exception 'ReflectionException' with message 'Class CompareControllerOverrideOriginal_remove55e73f55d7e87 does not exist' in /home/dezwaluw/public_html/demo/store_4/classes/module/Module.php:2638 Stack trace: #0 /home/dezwaluw/public_html/demo/store_4/classes/module/Module.php(2638): ReflectionClass->__construct('CompareControll...') #1 /home/dezwaluw/public_html/demo/store_4/classes/module/Module.php(2482): ModuleCore->removeOverride('CompareControll...') #2 /home/dezwaluw/public_html/demo/store_4/classes/module/Module.php(595): ModuleCore->uninstallOverrides() #3 /home/dezwaluw/public_html/demo/store_4/modules/DataSheetPro/DataSheetPro.php(61): ModuleCore->uninstall() #4 /home/dezwaluw/public_html/demo/store_4/controllers/admin/AdminModulesController.php(519): DataSheetPro->uninstall() #5 /home/dezwaluw/public_html/demo/store_4/controllers/admin/AdminModulesController.php(1089): AdminModulesControllerCore->postProcessReset() #6 /home/dezwaluw/public_html/demo/store_4/classes/controller/Controller.p Edited September 2, 2015 by Crezzur (see edit history) Link to comment Share on other sites More sharing options...
shacker Posted September 16, 2015 Share Posted September 16, 2015 try this one publicfunction uninstall($delete_params = true){if (!parent::uninstall()) {return false;}if ($delete_params) {if (!$this->uninstallDB()) {return false;}}return true;} 1 Link to comment Share on other sites More sharing options...
Crezzur.com Posted September 16, 2015 Author Share Posted September 16, 2015 try this one public function uninstall($delete_params = true) { if (!parent::uninstall()) { return false; } if ($delete_params) { if (!$this->uninstallDB()) { return false; } } return true; } That one works to, Found another working for someone who might need it. public function uninstall() { if (!parent::uninstall() || !Configuration::deleteByName('data_sheet_pro')) { return false; } else { return true; } } ~ Solved Link to comment Share on other sites More sharing options...
shacker Posted September 16, 2015 Share Posted September 16, 2015 perfect 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