Thread: Admin Overrides

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Jun 2012
    Posts
    412
    Plugin Contributions
    0

    Default Admin Overrides

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

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,497
    Plugin Contributions
    88

    Default Re: Admin Overrides

    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.

  3. #3
    Join Date
    Jun 2012
    Posts
    412
    Plugin Contributions
    0

    Default Re: Admin Overrides

    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?

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,497
    Plugin Contributions
    88

    Default Re: Admin Overrides

    Quote Originally Posted by Dave224 View Post
    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.

    0. 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.

    1. 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.

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

    3. 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.

  5. #5
    Join Date
    Jun 2012
    Posts
    412
    Plugin Contributions
    0

    Default Re: Admin Overrides

    Thank you!

  6. #6
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,591
    Plugin Contributions
    30

    Default Re: Admin Overrides

    This not in the docs?
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  7. #7
    Join Date
    Jun 2012
    Posts
    412
    Plugin Contributions
    0

    Default Re: Admin Overrides

    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.

  8. #8
    Join Date
    Jun 2012
    Posts
    412
    Plugin Contributions
    0

    Default Re: Admin Overrides

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

  9. #9
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,703
    Plugin Contributions
    123

    Default Re: Admin Overrides

    > 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 Modifications
    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.

  10. #10
    Join Date
    Jun 2012
    Posts
    412
    Plugin Contributions
    0

    Default Re: Admin Overrides

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

 

 
Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR