larsodius Posted April 18, 2011 Share Posted April 18, 2011 Hi all,I have created an override in overrides/controllers/ for categoryController, thanks to some of the posts on here. I wanted to add some functionality to the process function. Basically, i extended the class, copied the original process function into my new file and added my changes. It works fine, just needs tidying up and some more validation.Anyway, my question is - do I have to copy the entire process function (which seems like overkill) or is there someway to just add my functionality and call it at the appropriate time? I need it to run after we get the category products (see below) as I'm using the products it returns. $cat_products = $this->category->getProducts((int)(self::$cookie->id_lang), (int)($this->p), (int)($this->n), $this->orderBy, $this->orderWay); //my stuff here Hopefully I'm making sense and someone can advise me.Thanks. Link to comment Share on other sites More sharing options...
larsodius Posted April 19, 2011 Author Share Posted April 19, 2011 Thanks for that angora. Figured I'd have to overwrite it all most likely, but at 1.00am after a few hours getting to grips with prestashop you start to question the validity of everything. Slight pain if the core gets updated enough to change the process function....Might look at the module/handle route as well, but for now overriding the function was relatively painless and is doing the job, so I'll leave that adventure for another day.Thanks again. Link to comment Share on other sites More sharing options...
maofree Posted April 29, 2011 Share Posted April 29, 2011 I angoraCan I ask you a question?In other CMS to override a file it's necessary only put a file with the same name in the override's folder, with prestashop it doesn't work, because if you copy ContactController.php in /override/controllers/ContactController.php, after appear an error that said Fatal error: Cannot redeclare class ContactControllerCore in /var/www/prestashop1410/prestashop/override/controllers/ContactController.php on line 263prestashop should controll this redeclarationI want to override all that file how is it possible????thanks Link to comment Share on other sites More sharing options...
maofree Posted May 2, 2011 Share Posted May 2, 2011 Hi angoraI've found a good solution for the controllers overrideYou must only remove Core from the name of the class likeContactControllerCore you must replace it with ContactControllerbyeeee 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