Jump to content

Classes structure changes in PS 1.5.4 onward


alsitn
 Share

Recommended Posts

Hi all,


 


I've had an interesting chat with Nemo1 (thank you!) today concerning Presta classes, controllers and overrides.


Fact is that Presta has undergone a deep change since version 1.5.4 that has left the override folders empty of all its files.


Now, the question is "how come many classes can extend an abstract father class when there is no such class anymore but still working???"


 


Let's make an example.


Until version 1.5.3.1 "abstract class Module extends ModuleCore" (the one that is extended by any module) did exist in %root%/override/classes/module/Module.php (github)


 


You could find that class declared in class index file too (%root%/cache/class_index.php - github), a file that lists all the classes related to autolad.php which is called by almost anything:


'Module' => 'override/classes/module/Module.php'


 


Now, since version 1.5.4.0 Module.php in override/module/ folder is no more.


Moreover, it's also missing in class_index file too (github) !!!


'Module' => ''


Only ModuleCore class is still in place (%root%/classes/module/Module.php)


 


What I don't get is how a module can extend a class that is not explicitly declared anymore (ie. "class BlockCart extends Module" ???).


Same goes for all the other "Core"s.


Again, this is true since version 1.5.4.0 ownard.


 


Please, anyone can help to shed some light on this mystery?


  • Like 1

Share this post


Link to post
Share on other sites

Prestashop uses a class autoloader that appends Core to the class name.  So when you try to instantiate a class Cart, Prestashops autoloader first looks for a class named Cart in overrides, and then looks for a class named CartCore in classes folder.

  • Like 2

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More