fanta1977 Posted February 12, 2014 Share Posted February 12, 2014 Hy everybody. I create few new modules and I'm trying to make them to be easy to install. But I have few problems. First question that I have is hove to on the easy way add u new function which does not exist to some class, specifically I'm trying to add a new function to class ShopUrl? I put the class like this in ShopUrl.php in my modul in folder: override/classes/shop/ with code like this: class ShopUrlCore extends ObjectModel { public static function someFunctionl($id_parametar1, $id_parametar2) { $ res = .... return $res; } } I know that my function work beacuse when I put her directly in orginal ShopUrl.php it works with no problem. Second question is how to change some existing functions? For example, I change some function which is ussually in Tools.php. Now how to write only the part of code that will always on the easy way override existing function in Tools.php and not that I need override entire class? Thanks in adwance for every help. P.S. I read the manuall on PrestaShop pages but id does not have me no sence, so I need help from good people of this forum. Link to comment Share on other sites More sharing options...
fanta1977 Posted February 13, 2014 Author Share Posted February 13, 2014 Is there no one who can help me or explain me how to solve my problem? Link to comment Share on other sites More sharing options...
CartExpert.net Posted February 13, 2014 Share Posted February 13, 2014 Hi. You need to create the file to override the core function. So it would be like: class ShopUrl extends ShopUrlCore You can add the new and the overriden functions there. Regards.Robin.The CartExpert Team Link to comment Share on other sites More sharing options...
fanta1977 Posted February 13, 2014 Author Share Posted February 13, 2014 I try to that but it does not work for me. Ok, there is file ShopUrl.php whicch is located in folder classes/shop/ and content of class in that file begins like: class ShopCore extends ObjectModel { ... } Now I create my own file which I also call ShopUrl.php and I put code like you show me: class ShopUrl extends ShopUrlCore { ... } If there is no mistake in my code and steps until now (if there is please show me and tell me) I have two questins for you. 1. question is in which folder I should put my file ShopUrl.php in my module? Directly in override folder or in folder like this override/shop/ ? 2.question is how should I make a call from my module of my new created function in overriden folder? I was trying like this: ShopUrl::someFunction(parametar1,parametar2); Thanks in adwance for any help Link to comment Share on other sites More sharing options...
El Patron Posted February 13, 2014 Share Posted February 13, 2014 try this (where to place override in module structure 1.5) module_folder/override/classes/shop/ShopUrl.php 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