Les Arbres Web Solutions

Ajax Errors

There is a bug in the Google Analytics plugin by Peter Bui that causes Ajax errors in several of our extensions. The bug causes this error in Joomla, which corrupts the response expected by the Javascript:

Error 0, Call to a member function getType() on null at line 64 of .... /plugins/system/GoogleAnalytics/GoogleAnalytics.php

This plugin appears to have been removed from the Joomla Extensions Directory, so our advice now is to uninstall it. In case you still want to fix it, we'll keep the following fix published for a while longer.

The error occurs when a request includes the URL parameter "format=raw", as typically used in Ajax requests.

This bug has been affecting users of FlexiContact Plus and Rentalot Plus since early 2021, and still has not been fixed. We have contacted the author but have not received a response. Other users have also contacted the author without success, so we are providing a fixed version here.

The fix is very simple. We just added a single line at the start of the onAfterRender() function:

	function onAfterRender()
		$this->document = JFactory::getDocument();	// Fix added by Les Arbres Design
		if ($this->app->isClient('administrator') || $this->document->getType() != 'html') {

You can either apply the fix to the author's official release yourself, or download our fixed version below.

Version 5.0.1