Tutorials for Magento and Joomla! - Yireo

MageBridge output tests

Within MageBridge, there are various tools that help you troubleshoot problems with the bridge. One of these tools is a Magento controller-class that can be called from Joomla!. The controller-class outputs various types of data to make it easier to check if MageBridge is outputting data or not.

What is a Magento controller?

While it is not needed to understand the functionality of a Magento controller-class for this tutorial, it should be regarded as general knowledge of Magento architecture which makes it easier to troubleshoot problems in Magento. A controller is part of a Magento extension (following the MVC-design pattern) which basically handles URLs.

Every time Magento is called through a certain URL and this URL is eventually mapped to a certain Magento extension, within that extension a certain controller-class and within that controller-class a certain PHP-method. So by calling a certain URL from your browser, you're actually executing a certain PHP function.

Replicating Magento URLs in Joomla!

While the Magento URLs can be called through the Magento frontend, every URL can also be bridged using MageBridge. From within Joomla! you can enter the path of the MageBridge Root Menu-Item (which serves as the Magento homepage within Joomla!) plus a Magento URL, meaning that the entire URL is bridged in Magento. It is very important to use the right URL pointing to your MageBridge Root Menu-Item (a Joomla! Menu-Item of the type Internal Link > MageBridge > Root).

If your Joomla! site would be available under http://JOOMLA/ and the alias of your MageBridge Root Menu-Item (as visible in the Joomla! Menu Manager) is ROOT, then the following URLs could be used in your browser:

http://JOOMLA/ROOT/customer/account/login
http://JOOMLA/ROOT/wishlist
http://JOOMLA/ROOT/checkout/cart 

Using the MageBridge controller-class

MageBridge offers a test controller that can be called in a similar way. If you call upon this MageBridge controller (or: specific URLs that call the MageBridge controller) you can test whether certain types of output are bridged correctly. Because other elements (like Joomla! modules and the Joomla! template) are stripped from the page, these tests offer a clean view on the bridge and allow easier troubleshooting.

Please note that for these tests to work, you need to enable debugging for your specific IP-address in the MageBridge Configuration in the Joomla! backend.

MageBridge test 1: Simple echo and nothing

By calling the following URL, you can initiate Magento from within Joomla! while requesting a simple echo-string from the MageBridge controller-class.

http://JOOMLA/ROOT/magebridge/output/test1

This should print a simple word test on your screen. If this fails, it most likely means the entire bridge is not functioning. You should check the Apache errorlogs for any PHP Fatal Errors, but also enable debugging in Magento for extra clues.

MageBridge test 2: Simple echo and exit

By calling the following URL, you can initiate Magento from within Joomla! while requesting a simple echo-string from MageBridge, after which the Magento application is terminated.

http://JOOMLA/ROOT/magebridge/output/test2

This should again print a simple word test on your screen. This test actually extends test 1.

MageBridge test 3: JSON test

By calling the following URL, you can initiate Magento from within Joomla! while requesting a basic JSON-array:

http://JOOMLA/ROOT/magebridge/output/test3

This should output the following:

{"test":"yes"}

If it outputs different data, this means JSON is not functional - which is a bare requirement of MageBridge to transfer more complex data from Magento to Joomla!. If this test fails, it could be that PHP Magic Quotes are enabled while they should not: Contact your hosting provider to disable this outdated setting.

MageBridge test 4: Initialize Magento layout

By calling the following URL, you can initiate Magento from within Joomla! while requesting a page with just one single block in it:

http://JOOMLA/ROOT/magebridge/output/test4

This should output the following:

test block

If the Magento layout is loaded instead, this means the test has failed - perhaps because one of the MageBridge theming files was missing. Make sure all MageBridge files are correctly uploaded to Magento, either by updating MageBridge through the Magento backend or by using the Magento patch-file within the Downloads section of your Yireo Account.

If a 500 Internal Server Error occurs, consult your hosting provider about the reasons why.

Created on Monday, 17 January 2011
Modified on Monday, 17 January 2011

About Yireo

Yireo tries to help webdevelopers build successful Joomla! and Magento sites.

More about Yireo