Using MageBridge stores to load a different Magento theme

The Magento multi-site concept is flexible but a little complex. It uses three levels which can be used in various ways: Websites, Stores and Store Views. Within the MageBridge Configuration the entire Joomla!-side of the bridge is configured as a Website. But within this Joomla! site you can still use Stores and Store Views for various purposes. For instance: To load a different theme.

The MageBridge Website

mb_store_websiteWhen setting up the bridge between Joomla! and Magento, one of the first steps is to configure the Magento Website which should be used within Joomla!. Because Magento connects a Root Catalog to this configuration, MageBridge is unable to show any catalog information on the frontend unless this step is taken.

Store Connectors

But besides configuring the Website itself, there are options to load other stores as well. For instance, when the visitors language switches from German to English, you'll want to load the appropriate Store or Store View. This is how Magento deals with multi-lingual content - it uses different stores under different circumstances.

mb_store_relationsMageBridge is just bringing this principle to Joomla!. As soon as a different language is chosen in for instance JoomFish or Nooku (both are multi-lingual components for Joomla!), MageBridge detects this and switches to the appropriate Magento store. This functionality is made possible through a MageBridge Store Connector.

The cool thing about Store Connectors is that they are relatively simple to build. This means you can hook in your own logic to determine which Magento store to use under which circumstances. Besides connectors for JoomFish and Nooku, there is also a connector called Special Days that let's you load a different store on Christmas for instance. You can create your own connectors as well, which requires little PHP-knowledge.

The default Store Relation

mb_store_defaultStore Connectors are configured by browsing with the Joomla! backend to the MageBridge page Store Relations. What you need to configure is a relation between the Magento store and the MageBridge Store Connector. For instance, when loading the JoomFish language English you'll want to load the Magento Store View English as well.

One of the hidden features is that you can also set a default Store Relation. This serves actually in more or less the same way as the main Website configuration, mentioned earlier. So instead of loading by default a Magento Website, you're loading a Magento Store or Store View. It doesn't make much sense, does it? But there are some nice tricks to play here.

Using one Website for two domains

Let's say you have an existing Magento store under domain A which has a large catalog of products. Now you want to use the same catalog under domain B by using MageBridge. Magento states that you should use the multi-site principle here, so you would normally create a new Website B in Magento and use this Website B within MageBridge on domain B.

The problem here is that every product in the catalog is assigned to Website A and not Website B. This would require you to reconfigure every product to be also assigned to Website B. Too much work, of course. So instead, you'll configure Website A as well for MageBridge on domain B. This is absolutely not following the rules of multi-site as suggested by Magento, but at least it gets things going.

Assigning different themes

mb_store_themesNow the problem is that suddenly two different domains make use of the same Website configuration. This will not cause any problem with the configuration or even caching, but what if you want two different Magento themes to be used? Let's say you have customized the Magento theme for domain A, but you want to use the Magento Blank Theme for the MageBridge website.

The solution is simple: Add an extra Magento Store for MageBridge within the Magento store management. Configure this store within the Joomla! backend as default Store Relation. Next, you can use the Magento configuration to load a different theme specifically for the MageBridge store used under domain A (under Magento Admin Panel > System > Configuration > General > Design).

More options

Actually, this setup opens up for much much more options. You can completely reconfigure the Magento configuration for the MageBridge environment to make it behave differently. Note that if you setup a single Magento Website for two domains, both domains will not only share the same catalog but also the same customers.

All this shows you that MageBridge is flexible enough to deal with various multi-site configurations. It just requires some thinking to get it going.