• Trying to translate a Woocommerce string using Loco Translate and I get this error message:

    Error: function theChampLoadEvent(e){var t=window.onload;if(typeof window.onload!=”function”){window.onload=e}else{window.onload=function(){t();e()}}}. Check console output for debugging information

    Any idea why is this happening?

    Regards,

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Tim W

    (@timwhitlock)

    Because a badly behaved plugin is breaking Ajax functions by printing code out when it shouldn’t.

    What plugin/theme does theChampLoadEvent functionality come from? It should be reported to them as a bug and is a very easy one to fix.

    Thread Starter Vitor

    (@mlvitor)

    Hi Tim,

    Thank you very much for your reply.

    As far as I could understand, Super Socializer plugin is the only one using this “theChampLoadEvent” function, so maybe it is the bad one.

    I am using Loco Translate 2.1.3 and Super Socializer 7.11.11.

    https://www.ads-software.com/plugins/super-socializer/

    Regards,

    Plugin Author Tim W

    (@timwhitlock)

    I’ve installed the plugin producing the output and it appears to be fine on my system during Ajax operations. So not pointing the finger just yet.

    It’s possible that something else is forcing a normal web page to render instead of the Ajax response. Can you please post what you see on the diagnostics page at Loco Translate > Settings > Debug ?

    Thread Starter Vitor

    (@mlvitor)

    Hard to find without the WP_DEBUG set to true ??

    Versions
    Loco Translate:
    2.1.3
    WordPress:
    4.9.5
    PHP:
    7.0.30 (cgi-fcgi)
    Server:
    Apache
    Unicode
    UTF-8 rendering:
    ΟΚ ?
    Multibyte support:
    Yes
    Ajax
    Endpoint:
    /wp-admin/admin-ajax.php
    JSON decoding:
    ΟΚ ?
    Ajax test result:
    ΟΚ ?
    Limits
    WP_MEMORY_LIMIT:
    40 MB
    WP_MAX_MEMORY_LIMIT:
    256 MB
    PHP memory_limit:
    256 MB
    PHP post_max_size:
    8 MB
    PHP max_execution_time:
    30
    Filesystem
    Custom languages directory:
    wp-content/languages/loco
    Directory writable:
    Yes
    File mods disallowed:
    No
    File mod safety level:
    Warn
    Debug settings
    WP_DEBUG:
    On
    WP_DEBUG_LOG:
    Off
    WP_DEBUG_DISPLAY:
    On
    PHP display_errors:
    On
    PHP log_errors:
    On
    PHP error_log:
    error_log

    Plugin Author Tim W

    (@timwhitlock)

    Thanks. Well the Ajax test is fine, so I think something is blocking the specific operation on your WooCommerce file. Possibly some security software.

    Can you use your network inspector and see what the actual page being rendered looks like? Example: https://localise.biz/wordpress/plugin/faqs/ajax-errors#debug

    Thread Starter Vitor

    (@mlvitor)

    Sorry this is going far away…
    As much as I understand, admin-ajax.php is called several times and sometimes it returns 404 status.
    If I disable Super Socializer, the error changes to:

    Error: (window.gaDevIds=window.gaDevIds||[]).push(‘5CDcaG’);

    And its impossible to save Woocommerce custom translation as well.

    I tryed to translate other plugin using custom translation and it worked.

    I deleted the custom Woocommerce translation and tryed to translate the original file and the error changes to:

    Error: Notice: Trying to get property of non-object.

    No hope ??

    @timwhitlock

    Because a badly behaved plugin is breaking Ajax functions by printing code out when it shouldn’t.
    What plugin/theme does theChampLoadEvent functionality come from? It should be reported to them as a bug and is a very easy one to fix.

    This is the Javascript code our plugin prints in the HTML source of the webpages to get the plugin working.
    FYI, when you see some Javascript/HTML code being rendered as response of an AJAX request, it doesn’t mean that the plugin to which the code being rendered belongs is breaking the AJAX request. It means there is something wrong with that AJAX request. That request is not successful and that’s why it is returning/outputting the HTML code of the website.

    Plugin Author Tim W

    (@timwhitlock)

    @heateor I clarified that in my second comment after investigating. Your plugin is not at fault – but as you say – something is causing a page to be rendered when it shouldn’t, hence something is badly behaved.

    @mlvitor I still need to see the full output from your network inspector preview pane, like in my example. I still think the most likely cause is security software blocking the request.

    Thread Starter Vitor

    (@mlvitor)

    So far, I don’t have security software active. The full output of network inspector of which file?

    The error only happens when I try to translate the Portuguese version.
    Portuguese (Portugal) (pt_PT) – Last updated 2018-05-07 16:44:26 for version 3.3.5
    https://translate.www.ads-software.com/projects/wp-plugins/woocommerce/language-packs

    After deleting previous files and uploading the PO & MO files again to “/wp-content/languages/loco/plugins” and trying to edit pt_PT custom translation again I get the error:

    Error: Notice: Trying to get property of non-object. Check console output for debugging information.

    Deactivating the “Simple Google Map” the error above changes back to:

    function theChampLoadEvent(e){var t=window.onload;if(typeof window.onload!=”function”){window.onload=e}else{window.onload=function(){t();e()}}}.

    Deacivating the “Super Socializer” the error changes to:

    Error: (window.gaDevIds=window.gaDevIds||[]).push(‘5CDcaG’);

    The more I dig… worse. Is there any chance to the main cause of the errors be related to something wrong with the MO/PO files?

    When I create and translate a custom English UK version, for instance, all works fine.

    Plugin Author Tim W

    (@timwhitlock)

    So far, I don’t have security software active.

    Some hosting providers may install a web application firewall without your realizing, but if you say there’s nothing then let’s forget about that.

    The full output of network inspector of which file?

    Of the Ajax request that is causing the problem. It will show up as you click “save” which is (I assume) the action showing the errors?

    Error: Notice: Trying to get property of non-object.

    With WP_DEBUG enabled you might see these coming from all over your site. If this is coming from my plugin please tell me, but I suspect it’s a red herring.

    The changes in “error message” as you enable/disable things all seem irrelevant. That text you see is just the part of the web page being rendered when no web page should be rendered at all. It is seeing that web page that I’m trying to get to.

    Is there any chance to the main cause of the errors be related to something wrong with the MO/PO files?

    I have no problem with the PO/MO files you linked to.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Error: function theChampLoadEvent’ is closed to new replies.