serralta Posted June 15, 2014 Share Posted June 15, 2014 (edited) Hi everybody. I am trying to develop an easy module. It is my first one, so it may be some stupid problem but the fact is I'm stuck with it from some days ago. I have a simple module that has a override/classes/Product.php class. It adds a simple single method. When I install it, all is fine. The overriden Product class is generated. The problem is when I do some changes and I try to reinstall it (reseting it or uninstalling and installing, again, the result is the same). The method I added to the overriden class is not deleted completly when I uninstall the module. Only the name is removed but not the function body. This causes a Fatal error: Uncaught exception 'ReflectionException' with message 'Class ProductOverrideOriginal_remove539defbda2a6c does not exist' I paste the generated code. When I install the module for first time I got: class Product extends ProductCore { public function getLocalizationImage(Context $context = null) { return true; } } When I reinstall it, or uninstall it the classe is left as follows: class Product extends ProductCore { { return true; } } Is it normal? What am I missing? The same problem if I do a second module that adds a DIFFERENT function to the Produt class. The second module I install has no name in its function declarations. Any help would be appreciate. Thanks! Edited June 15, 2014 by serralta (see edit history) Link to comment Share on other sites More sharing options...
yotch Posted July 6, 2014 Share Posted July 6, 2014 hi, delete all your file overrided in www/override and read www/override/readme_override.txt which tel : in order to reinstate the default behavior, you must delete the /cache/class_index.php file 1 Link to comment Share on other sites More sharing options...
xiparos Posted January 21, 2015 Share Posted January 21, 2015 I don't think delete /cache/class_index.php file would solve the problem. I've found this workaround here http://stackoverflow.com/questions/18996528/how-to-remove-override-when-uninstalling-the-module-in-prestashop not a perfect solution but you have to manually remove any file generated in override directory. still looking forward to better elegant solution. 1 Link to comment Share on other sites More sharing options...
zelakioui Posted January 23, 2016 Share Posted January 23, 2016 (edited) Thinks, hi, delete all your file overrided in www/override and read www/override/readme_override.txt which tel : in order to reinstate the default behavior, you must delete the /cache/class_index.php file Thanks you have solved my problem with overriding controllers Edited January 23, 2016 by zelakioui (see edit history) 1 Link to comment Share on other sites More sharing options...
sfweb Posted November 21, 2020 Share Posted November 21, 2020 On 6/15/2014 at 9:15 PM, serralta said: Hi everybody. I am trying to develop an easy module. It is my first one, so it may be some stupid problem but the fact is I'm stuck with it from some days ago. I have a simple module that has a override/classes/Product.php class. It adds a simple single method. When I install it, all is fine. The overriden Product class is generated. The problem is when I do some changes and I try to reinstall it (reseting it or uninstalling and installing, again, the result is the same). The method I added to the overriden class is not deleted completly when I uninstall the module. Only the name is removed but not the function body. This causes a Fatal error: Uncaught exception 'ReflectionException' with message 'Class ProductOverrideOriginal_remove539defbda2a6c does not exist' I paste the generated code. When I install the module for first time I got: class Product extends ProductCore { public function getLocalizationImage(Context $context = null) { return true; } } When I reinstall it, or uninstall it the classe is left as follows: class Product extends ProductCore { { return true; } } Is it normal? What am I missing? The same problem if I do a second module that adds a DIFFERENT function to the Produt class. The second module I install has no name in its function declarations. Any help would be appreciate. Thanks! Hi, I'm having the same problem, did you find a solution? Let me know. Regards. Link to comment Share on other sites More sharing options...
rrataj Posted November 22, 2020 Share Posted November 22, 2020 What is in your "uninstall()" method? Link to comment Share on other sites More sharing options...
sfweb Posted November 23, 2020 Share Posted November 23, 2020 17 hours ago, rrataj said: What is in your "uninstall()" method? Hi, this is my code for uninstall method: public function uninstall() { Configuration::deleteByName('PECSDIFIELDS_SHOW_REDLABEL'); include(dirname(__FILE__).'/sql/install.php'); return parent::uninstall(); } Link to comment Share on other sites More sharing options...
sfweb Posted November 23, 2020 Share Posted November 23, 2020 Hi, I solved my problem, my mistake was in the class I was overriding; here I found the right way to create the override. http://nemops.com/extending-prestashop-objects/#.X7uP52hKhhG 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