Sebastien Antic
Sebastien Antic

Reputation: 21

Overriding module class in prestashop 1.7.6

I'm trying to override a class from a module I installed. The class is located in the modules folder in MyModule/lib/MyClass.php So what i did is create a copy of that class in override/modules/MyModule/lib/MyClass.php and it's declared like this:

    class MyClassOverride extends MyClass {
        // custom code
    }

I also deleted the class_index.php file.

And my changes are not applied so i really don't know what I am missing here. Is it even possible to do that ? I heard that in previous versions of prestashop you couldn't override a module class...

Anyone has an idea ?

Upvotes: 2

Views: 693

Answers (1)

Valentin S.
Valentin S.

Reputation: 35

I have the same problem.

It seems that it's possible to override a php class for a module if the class is in MyModule/MyClass.php, but it doesn't work if the class is in MyModule/lib/MyClass.php...

Upvotes: 1

Related Questions