How can I force module's install() function to copy files to override folder?

Refresh

April 2019

Views

702 time

1

I'm creating a module which includes a new version of list_footer.tpl which exists in presta\admin1234\themes\default\template\helpers\list\list_footer.tpl

So basically all I want from my module is to copy my list_footer.tpl to presta\override folder.

Question is, how should I write the install() function for this purpose?

I tried:

  public function install()
  {
    if (parent::install() == false) {
      copy(__DIR__.'/override/list_footer.tpl', _PS_ROOT_DIR_.'/override/helpers/admin/templates/list');

      return false;
    }
    return true;
  }

Module's install doesn't throw any error, but list_footer.tpl is not copied to override folder.

1 answers

1

The second parameter of the copy functio must be a file, not a folder. Of course the folder of the file must exist.