Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2013
    Posts
    898
    Plugin Contributions
    0

    Default zx_pos plugin: PHP Fatal error: Uncaught Error: Call to protected method

    VERSION 210 PHP 8.3
    getting this error, how do i fix this Please?
    Code:
    [21-Jan-2025 03:01:21 UTC] Request URI: /ajax_process.php, IP address: 35.139.236.145
    --> PHP Fatal error: Uncaught Error: Call to protected method Zencart\LanguageLoader\ArraysLanguageLoader::loadDefinesFromArrayFile() from scope Zencart\LanguageLoader\LanguageLoader in /includes/classes/ResourceLoaders/LanguageLoader.php:47
    Stack trace:
    #0 /ajax_process.php(927): Zencart\LanguageLoader\LanguageLoader->loadDefinesFromFile()
    #1 {main}
    thrown in /includes/classes/ResourceLoaders/LanguageLoader.php on line 47.
    
    [21-Jan-2025 03:01:21 UTC] Request URI: /ajax_process.php, IP address: 35.139.236.145
    --> PHP Fatal error: Uncaught Error: Call to protected method Zencart\LanguageLoader\ArraysLanguageLoader::loadDefinesFromArrayFile() from scope Zencart\LanguageLoader\LanguageLoader in /includes/classes/ResourceLoaders/LanguageLoader.php:47
    Stack trace:
    #0 /ajax_process.php(927): Zencart\LanguageLoader\LanguageLoader->loadDefinesFromFile()
    #1 {main}
    thrown in /includes/classes/ResourceLoaders/LanguageLoader.php on line 47.
    here is lines from file
    Code:
    case 'customer_details':
                    global $languageLoader;
     line 927=>  $languageLoader->loadDefinesFromFile('', $_SESSION['language'], 'account.php');
                    $current_page = 'account';
                    require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
                    ob_start();
                    require_once($template->get_template_dir('/tpl_customer_details.php', DIR_WS_TEMPLATE, $current_page_base, 'templates/zxpos') . '/tpl_customer_details.php');
                    $content = ob_get_contents();
                    ob_end_clean();
                    $result['result_content'] = array('modalBody' => $content,
                        'modalTitle' => TEXT_MODAL_CUSTOMER_DETAILS);
                    $result['result_success'] = true;
                    break;

  2. #2
    Join Date
    Jun 2007
    Location
    Bronx, New York, United States
    Posts
    679
    Plugin Contributions
    8

    Default Re: Php fatal error

    Is this in regards to a plugin, if so which one?

  3. #3
    Join Date
    Jan 2013
    Posts
    898
    Plugin Contributions
    0

    Default Re: Php fatal error

    zx_pos, he said he will fix it but i guess he busy

  4. #4
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,616
    Plugin Contributions
    19

    Default Re: Php fatal error

    Yeah, sorry about that. As mentioned earlier, the plugin is currently compatible with up to 1.5.8. Updating it to work with 2.1.0 is on top of my priorities list, but my schedule has unexpectedly turned into a nightmare. I should be free after the first week of Feb and will be updating it first thing. Until then, I'm afraid I can't do much.

  5. #5
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,841
    Plugin Contributions
    11

    Default Re: Php fatal error

    Quote Originally Posted by balihr View Post
    Yeah, sorry about that. As mentioned earlier, the plugin is currently compatible with up to 1.5.8. Updating it to work with 2.1.0 is on top of my priorities list, but my schedule has unexpectedly turned into a nightmare. I should be free after the first week of Feb and will be updating it first thing. Until then, I'm afraid I can't do much.
    wow, this is your plugin? who knew....

    only because i truly like @balihr, i can provide some direction to the OP question.

    please note, that while this may solve your original error; a new error may/will pop up. (note the use of a linux not windows slash! )

    the situation is you want to load a language file, when ZC has not loaded it. this is how i solved this issue:

    create a file; call it something like:

    includes/functions/extra_functions/my_functions.php

    in that location.

    then within that file, put in the following code:

    PHP Code:
        function loadExtraLanguages(string $filenamestring $middleDir ''): void
        
    {
            global 
    $template_dir$languageLoader;

            if (empty(
    $middleDir)) {
                
    $middleDir '/' $template_dir;
            }

            
    $new_langfile DIR_FS_CATALOG DIR_WS_LANGUAGES $_SESSION['language'] . $middleDir '/' 'lang.' $filename;
            if (
    file_exists($new_langfile)) {
                
    $languageLoader->loadExtraLanguageFiles(DIR_FS_CATALOG DIR_WS_LANGUAGES$_SESSION['language'], $filename$middleDir);
            } else {
                
    $languageLoader->loadExtraLanguageFiles(DIR_FS_CATALOG DIR_WS_LANGUAGES$_SESSION['language'], $filename);
            }
        } 
    now, once that is done, on line 97 change accordingly:

    PHP Code:
    //from:
    $languageLoader->loadDefinesFromFile(''$_SESSION['language'], 'account.php');
    //to:
    loadExtraLanguages('account.php'); 
    the function will load either the new style language file, ie lang.account.php or the old style, depending on what exists for the specific file.

    please let us know if that works for you.

    you may run into other errors, but this is how i accomplished loading a language file when needed in zc v158 and onwards...

    you are welcome.

    best.
    Last edited by DrByte; 22 Jan 2025 at 04:41 AM. Reason: make function filename more generic, to prevent clashes
    author of square Webpay.
    mxWorks now has Apple Pay and Google Pay. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  6. #6
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,616
    Plugin Contributions
    19

    Default Re: Php fatal error

    Quote Originally Posted by carlwhat View Post
    wow, this is your plugin? who knew....

    only because i truly like @balihr, i can provide some direction to the OP question.
    awwwwwww

    Thanks bud, this might even show up in the new release, although the plan is to drop support for older ZC versions... But there's A LOT of work to be done with it and refactor it all, will see what my options are.

  7. #7
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,841
    Plugin Contributions
    11

    Default Re: Php fatal error

    Quote Originally Posted by balihr View Post
    awwwwwww

    Thanks bud, this might even show up in the new release, although the plan is to drop support for older ZC versions... But there's A LOT of work to be done with it and refactor it all, will see what my options are.
    this has nothing to do with older versions. in fact, i believe this function will only operate in v1.5.8 or greater environment. i have not tested it for use in v1.5.8; but definitely works in v2.x.x environments.

    and again, it's use is to load a necessary language file that was not loaded as part of the normal ZC operation for the specific script you are running.

    in the OP's situation, the script he is running is ajax_process.php. and he needs the language file for account.php. this function will load the relevant language file for account.php; and it will load either the new style (if it exists) or the old style if it does not.

    best.

    ps feel free to use it in your new release, just make sure i get some credit! https://mxworks.cc
    author of square Webpay.
    mxWorks now has Apple Pay and Google Pay. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

 

 

Similar Threads

  1. v200 PHP Fatal error: Uncaught Error: Undefined constant "MODULE_PAYMENT_PAYPALWPP_EC_RETU
    By vanhorn_s in forum PayPal Express Checkout support
    Replies: 5
    Last Post: 17 Jul 2024, 05:52 PM
  2. v157 PHP Fatal error: Uncaught Error: Call to undefined function ctype_digit()
    By katrobb in forum Installing on a Linux/Unix Server
    Replies: 2
    Last Post: 30 Jun 2021, 02:23 AM
  3. v156 PHP Fatal error: Uncaught Error: Class not found
    By Nick1973 in forum General Questions
    Replies: 7
    Last Post: 17 Apr 2020, 05:52 PM
  4. v156 PHP Fatal error: Uncaught Error: [] operator not supported for strings
    By chadlly2003 in forum General Questions
    Replies: 6
    Last Post: 6 Sep 2019, 01:37 AM
  5. v155 PHP Fatal error: Uncaught Error: Call to undefined function mysqli_close()
    By Brent in forum Installing on a Linux/Unix Server
    Replies: 2
    Last Post: 2 Apr 2018, 04:03 PM

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