Trampino Posted January 9, 2015 Share Posted January 9, 2015 (edited) Hello,could anybody help me please?I need to modify init () funciton in GetFileController.php in PrestaShop 1.6 So I made this: I created my own file GetFileController.php which contains this code <?phpclass GetFileController extends GetFileControllerCore{ public function init() { my modifications }}?> After that I created folder root/www/modules/mymodul/override/controllers/front/ and I uploaded my file GetFileController.php to this folder.I uploaded my file GetFileController.php to folder root/www/override/controllers/front/ too. But PrestaShop still use funcion inti () from origina file GetFileController.php which is placed in root/www/controllers/front 1) What I have to do to prestashop start to use my modified file?2) Is structure of my code correct? Sense of it is, that init function of Class GetFileControllerCore will do something a little bit different, than normally. Many thanks for your help. Edited January 9, 2015 by Trampino (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted January 9, 2015 Share Posted January 9, 2015 try to remove file class_index.php from cache directory Link to comment Share on other sites More sharing options...
Richard S Posted January 11, 2015 Share Posted January 11, 2015 Do not add two same Controllers in different places as this creates a misunderstanding in class_index.php.Make sure to have only one copy of overridden controller and remove class_index.php as vekia suggested Link to comment Share on other sites More sharing options...
Trampino Posted January 16, 2015 Author Share Posted January 16, 2015 Thanks for your help. My problem was partly solved by deleting of class_index.php from cash folder.But I have still one problem.I place my modified file GetFileController.php to directory root/www/override/controllers/front and delete cash/class_index.php. This variant woks perfect and my modified file GetFileController.php is used.BUTI create this structure of folders: root/www/modules/myownmodul/override/controllers/front/ . I place my modified file GetFileController.php to final folder in this structure of folders. I create record for modul myownmodul in database tables ps_module, ps_module_access, ps_module_group and ps_module_shop. I delete cash/class_index.php. But this variant does not work and standard file GetFileController.php is used.What is wrong?Many thanks for your help. Link to comment Share on other sites More sharing options...
bellini13 Posted January 16, 2015 Share Posted January 16, 2015 Prestashop only installs overrides from the module folder when you use the install button from the back office page. It does not sound like you have created a real module and installed it Link to comment Share on other sites More sharing options...
Trampino Posted January 16, 2015 Author Share Posted January 16, 2015 PrestaShop does not work anything itself :-) When you press instal button, than some code of prestashop is done. And this code automatically do may be some writing of data to some config files and probably do some inserts to database tables. And all of it can be done manually by programmer too. So pleas can somebody advise me, which modificaions in which config files and which modifications in which database tables I must to do, when I place my modified file to folder in structure of folders for modul (as I wrote above)? I need it, because I must implement and debug correct behavior of my modified code at first. Only after that, I can use my final and correct modified code as source for modul, which can be installable. Many thanks for your real help 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