alsitn Posted October 9, 2013 Share Posted October 9, 2013 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? 1 Link to comment Share on other sites More sharing options...
bellini13 Posted October 9, 2013 Share Posted October 9, 2013 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. 2 Link to comment Share on other sites More sharing options...
alsitn Posted October 9, 2013 Author Share Posted October 9, 2013 (edited) You are awesome!!! I totally skipped checking autoload.php thoroughly... my bad Thank you again!!! EDIT: I've tried to like your answer but I've reached my daily quota... will try tomorrow Edited October 9, 2013 by alsitn (see edit history) 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