Override a hook file

Open to all! Ask other shopowners for help.
Post Reply
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Override a hook file

Post 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?


Join The Code Co-op to get access to your library in the Code Co-op Forum
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Override a hook file

Post by ecartz »

Template overrides won't work in admin.

Try saving as admin/includes/classes/override/hook_admin_catalog_infopages.php
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: Override a hook file

Post 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.
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Override a hook file

Post 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


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply