Jump to content

override does not work


Trampino

Recommended Posts

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

<?php
class 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 by Trampino (see edit history)
Link to comment
Share on other sites

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.

BUT

I 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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...