If this is your first visit, check our documentation. To post, register or login.

Admin Overrides

Started by dave224 on 26 Mar 2024, 1:43 PM · Views: 3,156

Results 1 to 11 of 11
26 Mar 2024, 1:43 PM
#1
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Post #1 by dave224

Is it possible to override files contained in admin/includes/languages/english/images/buttons in admin/includes/languages/english/extra_definitions/images/buttons or place files for new buttons there so as not modify the admin core file(s)?

26 Mar 2024, 2:12 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #2 by lat9

Not in the /extra_definitions sub-directory, but you could add differently-named buttons to admin/includes/languages/english/images/buttons and then override the base language-file definitions via a lang.mysite_buttons.php file in admin/includes/languages/english/extra_definitions.

28 Mar 2024, 3:48 PM
#3
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Post #3 by dave224

Expanding my question a bit...I'm late to the 1.5.8a party and hopelessly confused about where to place array-based language defines so that no admin core files are modified for the following three cases:
(1) existing core defines I want to override for a specific page and an existing core admin/includes/languages/english/lang.PAGE.php file exists, and
(2) existing core defines I want to override for a specific page and an existing core admin/includes/languages/english/lang.PAGE.php file does not exist, and
(3) non-existing (custom) defines for one or more admin pages
Also, I gather the substring matching capability on the store side does not exist in admin. Is that correct?

28 Mar 2024, 7:31 PM
#4
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #4 by lat9

Dave224:

Expanding my question a bit...I'm late to the 1.5.8a party and hopelessly confused about where to place array-based language defines so that no admin core files are modified for the following three cases:
(1) existing core defines I want to override for a specific page and an existing core admin/includes/languages/english/lang.PAGE.php file exists, and
(2) existing core defines I want to override for a specific page and an existing core admin/includes/languages/english/lang.PAGE.php file does not exist, and
(3) non-existing (custom) defines for one or more admin pages
Also, I gather the substring matching capability on the store side does not exist in admin. Is that correct?
The admin-language overrides, as mentioned in a couple of other threads, are cumbersome.

  1. To override language definitions in the main language file, e.g. admin/includes/languages/lang.english.php, you can simply copy that file (renamed so you 'remember') to admin/includes/languages/extra_definitions and make your changes there. I'll recommend including only those definitions you're overriding.

  2. The cumbersome bit: There isn't a page-specific language-file override mechanism. The best I can offer is a admin/includes/languages/english/extra_definitions/lang.something.php that checks the $current_page (which needs to be a global since called from a class) and switch based on the page to do your page-specific overrides.

  3. This condition doesn't exist in the base Zen Cart distribution.

  4. For non-core admin pages, you can simply use admin/includes.languages/english/{lang.}new_page.php. For additional constants on in-core admin pages, see #1, above.

29 Mar 2024, 12:40 PM
#5
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Post #5 by dave224

Thank you!

29 Mar 2024, 4:04 PM
#6
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,880
Plugin Contributions:
7

Post #6 by torvista

This not in the docs?

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

29 Mar 2024, 5:58 PM
#7
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Post #7 by dave224

lat9...
I tried the admin/includes/languages/english/extra_definitions/lang.something.php approach with switch on $current_page. Got the following fatal error.

[29-Mar-2024 13:24:30 America/New_York] PHP Fatal error: Uncaught TypeError: array_merge(): Argument #2 must be of type array, int given in /domain/includes/classes/ResourceLoaders/ArraysLanguageLoader.php:67
Stack trace:
#0 /domain/includes/classes/ResourceLoaders/ArraysLanguageLoader.php(67): array_merge(Array, 1)
#1 /domain/includes/classes/ResourceLoaders/ArraysLanguageLoader.php(47): Zencart\LanguageLoader\ArraysLanguageLoader->processArrayFileList('includes/langua...', Array)
#2 /domain/includes/classes/ResourceLoaders/AdminArraysLanguageLoader.php(31): Zencart\LanguageLoader\ArraysLanguageLoader->loadArraysFromDirectory('includes/langua...', 'english', '/extra_definiti...')
#3 /domain/includes/classes/ResourceLoaders/AdminArraysLanguageLoader.php(18): Zencart\LanguageLoader\AdminArraysLanguageLoader->loadLanguageExtraDefinitions()
#4 /domain/includes/classes/ResourceLoaders/LanguageLoader.php(28): Zencart\LanguageLoader\AdminArraysLanguageLoader->loadInitialLanguageDefines(Object(Zencart\LanguageLoader\LanguageLoader))
#5 /domain/admin/includes/init_includes/init_languages.php(48): Zencart\LanguageLoader\LanguageLoader->loadInitialLanguageDefines()
#6 /domain/includes/autoload_func.php(40): require_once('/domain...')
#7 /domain/admin/includes/application_top.php(42): require('/domain...')
#8 /domain/admin/login.php(8): require('/domain...')
#9 /domain/admin/index.php(11): require('domain...')
#10 {main}
thrown in /domain/includes/classes/ResourceLoaders/ArraysLanguageLoader.php on line 67

The error occurs when loading the admin login screen. Any suggestions (other than give up)?

I have separate $define = [....]; return $define; code between each $current_page case and break statement plus a default case and break.

29 Mar 2024, 6:01 PM
#8
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Post #8 by dave224

torvista...Not that I could find for overriding admin language constants and file locations for same.

29 Mar 2024, 7:39 PM
#9
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,761
Plugin Contributions:
56

Post #9 by swguy

This not in the docs?

It's really not supported. There are sneaky tricks you can use but they might not work in all cases.

Just update the admin language files in place and do a diff when you upgrade.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

29 Mar 2024, 8:34 PM
#10
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Post #10 by dave224

Ok, I give up. Too bad, maybe in a future version.

29 Mar 2024, 9:30 PM
#11
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,761
Plugin Contributions:
56

Post #11 by swguy

The priority in admin is that you be able to extend or add functionality without modifying code files. Not language files; those are easy and fast to diff and patch.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.