Jump to content

Prestashop 1.4 - Adding new classes


csogilvie

Recommended Posts

Am I missing something?

In Prestashop 1.4 (RC2 ATM), it is possible to override some of the default classes that come with Prestashop, by putting files in the overrides/classes/ folder...

However, it doesn't appear that it's possible to ADD new classes by putting them in there - would this not make more sense or am I missing something as to why NEW classes need to be created in the classes/ folder?

Link to comment
Share on other sites

As I understand it; If you want your class to be for example "MyClass" then you create a file called MyClass.php in /classes and use the following declaration:

class MyClassCore extends ObjectModel
{

}



You'll notice that we had to add "Core" on the end. To use your class you just use:

$myvariable = new MyClass();



The side-effect of this is that you can override your own custom class (but would you really want to that often?), but yes, you're correct in saying that you would have assumed that you could have placed your own new classes directly into /overrides/classes and then extended just ObjectModel....

Paul

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...