Page 1 of 1

Override a hook file

Posted: Sun Apr 03, 2022 10:32 am
by heatherbell
With reference to this post viewtopic.php?f=28&t=1259
There I have changed /includes/hooks/admin/catalog/infopages.php and my changes work OK.
So I reverted the changes in the original hook file and then made the change to a copy and uploaded to /templates/override/includes/hooks/admin/catalog/infopages.php
Template Selection is set to override but the original hook file is not being overridden.
Any ideas what I am doing wrong?

Re: Override a hook file

Posted: Sun Apr 03, 2022 11:02 am
by ecartz
Template overrides won't work in admin.

Try saving as admin/includes/classes/override/hook_admin_catalog_infopages.php

Re: Override a hook file

Posted: Sun Apr 03, 2022 11:42 am
by heatherbell
ecartz wrote: Sun Apr 03, 2022 11:02 am Try saving as admin/includes/classes/override/hook_admin_catalog_infopages.php
Interesting. That kinda worked, that is, the override now works but it it now does not find the associated language file.
Just before

Code: Select all

    $tab_title = addslashes(INFOPAGES_TITLE);
I added

Code: Select all

include_once(DIR_FS_CATALOG . "includes/languages/$language/hooks/admin/catalog/infopages.php");
which fixed that.
Thanks again for your insight.

Re: Override a hook file

Posted: Sun Apr 03, 2022 11:57 am
by ecartz
You could also move the language file. It would look in admin/includes/languages/{$_SESSION['language']}/classes/override/hook_admin_catalog_infopages.php