0

I'm getting the following javaScript error on the checkout page:

js.js:667 Uncaught TypeError: element.dispatchEvent is not a function

At first I thought conflict but I'm pretty sure the order of script loading is correct - i.e. jQuery, noconflict, then prototype. Is this right?

I then realised my host had upgraded PHP to 5.6.17, so will try older versions tomorrow when I have time to re-configure the PHP Handler etc. But I think this is unlikely due to timing.

The Magento CE is 1.9.0.1 and PHP 5.6.17.

The issue is compounded by the fact that the setup is Joomla connected to Magento with Yireo's Magebridge.

5
  • Maybe my answer here can help you magento.stackexchange.com/a/86474/408 Jun 9, 2016 at 20:33
  • thanks @simonthesorcerer. No errors are being logged in system.log or exception.log and I changed the directory permissions to 777. Looking at the network tab in chrome developer tools, the savebilling action posts and receives a valid JSON response. Then getadditional posts and the response looks valid? <script type="text/javascript">function x9b19e(className) {var elements = document.getElementsByClassName(className);while(elements.length > 0){elements[0].parentNode.removeChild(elements[0]);}}x9b19e("ba188");</script>.
    – Al Ryalls
    Jun 10, 2016 at 7:25
  • I've tried PHP versions 5.4,5.5 and 5.6, same problem. Also changed the order of the JS files to 1. prototype, 2. jQuery, 3. noconflict. No good :(
    – Al Ryalls
    Jun 10, 2016 at 15:09
  • I'd also check what "element" is exactly when the error is thrown. The developer console gives a stacktrace if it is open when the error occurs; maybe "element" points to an ID that does not exist due to a non-standard checkout or sth else? Jun 10, 2016 at 15:18
  • element = "domready" set by a preceding function in mootools-core.js. If you could take a look I'd be eternally grateful as I really don't know how to proceed footactive.co.uk/magento-root/checkout/onepage
    – Al Ryalls
    Jun 12, 2016 at 20:16

1 Answer 1

0

You have some weird JS-function in your response.

This function x9b19e() is definitely not Magento standard. It will most likely be added by a 3rd party module or a malicious script that has infected your webhost.

It seems to be appended to every request to your server, and so it is also appended to the response received by the AJAX-request to /checkout/onepage/saveBilling. This response should be a valid JSON-string, and it would be one if not for the JS-snippet at the end.

If you have SSH-access to your server, you can find this snippet by doing grep -r "x9b19e" ./ in the Magento root directory. Find out why someone thinks it should be there, and either remove it or limit its use to the places where it is necessary.

UPDATE

Either the function is somewhere in one of the Joomla-extensions, in a malicious script or in one of the Magento-extensions (I don't know how MageBridge works, and if some of them are loaded when the Joomla-homepage is rendered). If you can't find it with grep, it could be that the code is generated or base64-decoded/-encoded at runtime.

I would start with checking the index.php-files for strange code, then disabling all Joomla-extensions one after the other and check after each one if the script is still there, then diff my Joomla-installation with a fresh download, then disable the Magento-extensions in the same manner like the Joomla extensions.

9
  • Wow, thanks man :) I ran the command and it doesn't find anything though?
    – Al Ryalls
    Jun 13, 2016 at 11:22
  • I took another look and noticed that the script is also on you start page, so maybe you should grep your Joomla installation as well; If you don't find the snippet there: if you make a simple file test.html in your webroot and visit it in the browser, is the <script... at its bottom then? Jun 13, 2016 at 11:41
  • I did run grep on the joomla installation as well but it's not found. And created test.html as you said and it's empty
    – Al Ryalls
    Jun 13, 2016 at 11:45
  • I ran grep -r "x9b19e" ./on the home directory and got this: ./virtfs/XXXXX/var/log/dcpumon/toplog.1465822201: 7185 root 20 0 219m 119m 744 R 68.8 0.4 0:08.57 grep -r x9b19e. There were more results after this as well. Is that just a log of my search?
    – Al Ryalls
    Jun 13, 2016 at 13:04
  • Yes, imho. Updated my answer Jun 13, 2016 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.