Using the MageBridge Content Plugin

Within the Joomla! architecture, Content Plugins allow you to modify articles or other types of content just before the content is sent back to the browser. The MageBridge Content Plugin uses this functionality but instead of changing the content itself, it makes Magento responsible for changing the content.

Bridging Magento content-filters

Many third party plugins within Joomla! allow you to add things to an article by adding specific tags to this article. Magento offers the same functionality, which is for instance shown in the Magento example data when visiting the CMS Pages. Within these CMS Pages, special tags can be placed - sometimes called CMS tags or markup tags. They look like the following:

{{block type="cms/block" block_id="foobar"}}

When the content is actually displayed, this markup tag is replaced with the HTML-output of a specific block. In this case, the block is a CMS Block with ID "foobar". The Magento markup tags allow you to easily insert Magento blocks in content, but there are more options as well.

mb_wysiwyg_cmsmarkup

The MageBridge Content Plugin allows you to send content through the bridge from Joomla! to Magento, where the content is parsed by these Magento content-filters. All Magento markup tags will be replaced and the result is send back to Joomla!. In short, the same tricks that are possible inside CMS Pages can now also be applied to Joomla! content.

What is content?

Parse Magento content with Joomla! logic, or Joomla! content with Magento logic?

The MageBridge Content Plugin allows you to parse content through Magento, but what is content? Joomla! is best known for its management of articles, so articles are the best example of content. But weblinks, contact-information, forum-threads and even modules can also be seen as content.

To complicate things, MageBridge ships with an option called Enable Content Plugins. This option is not the same thing as the actual MageBridge Content Plugin. The MageBridge Content Plugin allows you to parse Joomla! content through Magento content-plugins, but the option Enable Content Plugins allows you to apply Joomla! Content Plugins to Magento blocks.

Examples of markup tags

Markup tags are part of Magento, so it is not the task of MageBridge to document all possibilities. The Magento wikipage Markup Tags contains the official documentation. But here are some ideas anyway.

The following code calls upon the Magento Catalog-module and within this module the PHP-class Mage_Catalog_Block_Product_New which generates a list of newest products.

{{block type="catalog/product_new" template="catalog/product/new.phtml"}}

Another example shows you a listing of a category with ID 16:

{{block type="catalog/product_list" category_id="16" template="catalog/product/list.phtml"}}

Instead of using some pre-defined block, you could also use the type "core/template" to create your own specific PHTML-template, which could contain the Magento code you want:

{{block type="core/template" template="custom/my-template.phtml"}}

Creating links

Besides blocks, the Magento markup tags allow you to do other things as well. For instance the following tag refers to a specific image within the Magento skin:

{{skin url="images/media/example.png"}}

And here's a link to add a Magento product with ID 3 to the shopping cart:

{{store url=checkout/cart/add?product=3}}

Note that with Magento 1.8 or later, there is a form_key protection that prevents you from adding a product to cart with a simple URL like this. If you want this URL to work, you need to set the MageBridge option Disable Magento form_key to Yes.

You could also easily refer to a specific MageBridge page:

{{store url="customer/account"}}

However, if you want to create links to other MageBridge pages, there is an easier way to do this which does not require the MageBridge Content Plugin:

index.php?option=com_magebridge&view=root&request=customer/account

Our Yireo Tutorials also include non-MageBridge topics for including Magento markup tags to get specific results in your CMS pages. All these tricks also apply to Joomla! content when using the MageBridge Content Plugin.