Kevin Posted August 16, 2018 Share Posted August 16, 2018 Hi, I would like to override the class Category.php, the function getSubCategories with a custom order by. Problem is that Category.php extends the ObjectModel that has a namespace and these classes cannot be overridden. So my question is, how can i achieve what i want without modifying the core file Category.php? Thanks! Kevin Link to comment Share on other sites More sharing options...
Knowband Plugins Posted August 16, 2018 Share Posted August 16, 2018 (edited) Hi, I don't see any issue in overriding the Category.php (class). Just create the file Category.php inside the override/classes folder. Check the below code for reference. class Category extends CategoryCore { public function getSubCategories($idLang, $active = true) { //Do whatever you want to do. } } Edited August 16, 2018 by Knowband Plugins (see edit history) Link to comment Share on other sites More sharing options...
Kevin Posted August 16, 2018 Author Share Posted August 16, 2018 2 minutes ago, Knowband Plugins said: Hi, I don't see any issue in overriding the Category.php (class). Just create the file Category.php insider the override/classes folder. Check the below code for reference. class Category extends CategoryCore { public function getSubCategories($idLang, $active = true) { //Do whatever you want to do. } } That is exactely what i did, but that doesn't work. app/cache folder is not present(cache is turned off) so cannot delete that file. Link to comment Share on other sites More sharing options...
Kevin Posted August 16, 2018 Author Share Posted August 16, 2018 Ok, looks like from ps 1.7.4 you need to go to the admin performance and there press the button empty cache for overrides to start working. Issue solved. Link to comment Share on other sites More sharing options...
Knowband Plugins Posted August 16, 2018 Share Posted August 16, 2018 Kindly confirm in which folder you have placed the file? Means you have placed the file directly inside the ROOT/override/classes OR it's inside the module override folder? In case of module override folder, you need to reset the module (if the module is already installed) to reflect the changes (As the system will place the override file from module override folder to ROOT/override/classes on installation/Reset). Link to comment Share on other sites More sharing options...
Knowband Plugins Posted August 16, 2018 Share Posted August 16, 2018 4 minutes ago, Kevin said: Ok, looks like from ps 1.7.4 you need to go to the admin performance and there press the button empty cache for overrides to start working. Issue solved. Great 1 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