El Patron Posted May 17, 2014 Share Posted May 17, 2014 I can not for the life of me understand how, when I put a shop in demo mode (1.6.0.6) in this example, that the 'uninstall' function is still executed. could someone review this and let me know what I am doing wrong, thanks in advance. public function uninstall() { if (!parent::uninstall() || _PS_MODE_DEMO_ ) return false; $this->_do_uninstall_stuff(); return true; } Link to comment Share on other sites More sharing options...
bellini13 Posted May 17, 2014 Share Posted May 17, 2014 Since you are using || if the parent::uninstall fails (returns false), then demo mode is never evaluated. If you want both statements to be evaluated, then you need to use a single | if (!parent::uninstall() | _PS_MODE_DEMO_ ) If you are trying to avoid uninstalling the module while in demo mode, then you should reverse your statement so that demo mode is checked first, and if it is true then parent::uninstall will never trigger. Here you will use || if ( _PS_MODE_DEMO_ || !parent::uninstall() ) And sometimes it is better to just do this public function uninstall() { if (_PS_MODE_DEMO_) return false; if (!parent::uninstall()) return false; $this->_do_uninstall_stuff(); return true; } 1 Link to comment Share on other sites More sharing options...
El Patron Posted May 17, 2014 Author Share Posted May 17, 2014 Hi El Patrón, for testing: public function uninstall() { if (_PS_MODE_DEMO_ == true OR parent::uninstall() == false) return false; return true; } Regards This did it, I also tested bellini's solution, both worked great. Thanks for helping, my brain got very tired and needed a little help from the community to put me back on track. Link to comment Share on other sites More sharing options...
bellini13 Posted May 17, 2014 Share Posted May 17, 2014 What is wrong with my proposition? nothing wrong technically, I was just trying to explain why the original code did not work by offering additional detail. Link to comment Share on other sites More sharing options...
El Patron Posted May 17, 2014 Author Share Posted May 17, 2014 thanks again, for anyone interested in kicking the tires of 1606 in demo mode, here is demo shop [email protected] pwd demodemo my particular demo is modules-->back office performance happy day 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