Prestashop: how to override a module class contained in a file that includes other classes?
prepassing prestashop works like many others using a file naming scheme. So basically I will create a class in / overrides / classes with the same class and file name of another in / classes, just for simplicity. Well, I have to override this (with the latest versions of prestashop, the module can be overridden, but the previous one we could not):
include_once(dirname(__FILE__).'/MailAlert.php');
class MailAlerts extends Module{
[....]
}
I can override this with this:
class MailAlertsOverride extends MailAlerts{
[....]
}
Well it works, file and class are recognized, but I'm having problems with the originally included MailAlert class. I can't re-enable it, but if I don't enable it, the module will ask for it.
I would prefer not to change the parent class. Is there a way to solve this problem?
source to share
Ok, I was wrong: the code above works :)
For those who didn't know (this is a relatively new feature in prestashop), you can override the module in /override/modules/[modulename]/[modulename.php]
And using custom class assignment, you can read above: modulenameOverride extends modulename
source to share