Plugging things into MageBridge
Wednesday, 26 August 2009Last week MageBridge version 1.1 was released bringing multi-lingual features to the bridge. Multi-lingual components like Joom!Fish and Nooku were connected to Magento stores (either Store Groups or Store Views), but this logic was introduced through so-called store connectors.
Store connectors
Store connectors allow you to connect something in Joomla! to a specific Magento store. The best example is the connector for Joom!Fish. The MageBridge backend allows you to create a new store condition under which you select a Magento store and a Joom!Fish language. As soon as you load a product-page on the Joomla! frontend, MageBridge will call upon the Joom!Fish connector and this connector makes sure that the right Magento store is loaded.
Basically store connectors determine which Magento store is to be loaded. But determining the store by system language is just one example. In a patch on version 1.1 we have already released a store connector Special Days which loads a specific store on specific days (Eastern, Christmas). Also one of our customers is busy with loading the right store based on the geographical location of the customer.
So connectors open up for nice opportunities. Because of this, we already wrote a small tutorial on how to write store connectors. But things are just getting started.
Product connectors
Version 1.2 will introduce product connectors which take things to a higher level. While you can sell things using Magento, it would be even cooler if you could sell actually something relating to Joomla!. One of the more obvious products would be some kind of membership offered by Community Builder, JomSocial, Anahita or Open Source Excellence MSC.
Using a product connector, MageBridge will allow you to perform a specific action after a specific product is sold. For instance, the product connector is able to add the customer in question to a specific Anahita group after a product X was purchased. We are also investigating more exotic options like selling JomSocial Karma Points through the Magento webshop.
Regular Joomla! plugins
There are other things that need to be integrated as well. For instance when using Community Builder, you'll want the profile for an user to be synchronized with its Magento counter-part. For this, MageBridge makes use of the generic Joomla! plugin-architecture plus its own bridging features.
When an user changes its Community Builder profile, this event is picked up by a plugin - this plugin calls the MageBridge API and the bridge will make sure the Magento customer-profile on the other end is also changed. The reverse is also possible: As soon as the addressing information in Magento is altered, an event is generated, picked up by MageBridge, bridged to the other side and applied to the Community Builder profile as well.
For this to work, MageBridge uses an abstract concept called event forwarding, which makes sure that Joomla! events are transferred to Magento events and vice versa. Within Joomla!, there is an extra plugin group called "magento" which allows for third party developers to easily plugin their own functionality into MageBridge.
