Working with MageBridge URL Replacements
The feature URL Replacements allows you to replace Magento URLs with Joomla! URLs. This can be useful for replacing Magento product-pages with your own CCK-built catalog, but perhaps also for replacing pieces of functionality of Magento with Joomla! extensions (for instance the wishlist). URL Replacements uses a simple concept but it has some side notes, when you want to use it in practice.This tutorial explains the bits and pieces.
Configuring URL Replacements
URL Replacement uses two different techniques: First of all, MageBridge will search the generated HTML-code of Magento and replace the URLs according to the rules you have configured. Second, MageBridge will redirect a URL if a replacement URL exists.

Within the MageBridge pages in the Joomla! Administrator backend, you can configure URL Replacements. To create a new URL Replacement, use New in the Joomla! taskbar. With this you add a new rule, containing a Source URL and a Destination URL. The Source URL is a MageBridge URL that is to be found within Magento content. The Destination URL can be anything you want. These URLs are discussed below.
Optionally, you can also enter a Description for your own reference. The rule only becomes active when Published is set to Yes.
Source URL
The Source URL is the URL that is to be found within the Magento content fetched by MageBridge. There are two methods to describe this URL - you use the Source Type to determine which method should be used. When using URL Replacements, choosing the right Source URL in combination with the right Source Type is crucial for the correct working of your replacement.
The Source Type can be either the Original Magento URL or a so-called Partial Match. Here, the Original Magento URL actually refers to the path within the Magento URL. For instance, take the following URL:
http://MAGENTO/index.php/checkout/cart
The actual path of this URL (so the value of Original Magento URL) will be
checkout/cart
So the path is written without the domainpart and without the pointless /index.php/ indicator. Leading slashes and ending slashes are stripped from the value anyway, so those are safe to use. The Source URL can be either an absolute URL (like checkout/cart or catalog/product/view/id/7) or a SEF URL (like sony-vaio-820).
Partial Match
Setting the Source Type to Partial Match is much more complicated. The Source URL is matched partially within the text - for instance, if you would take the following Source URL with the option Source Type set to Partial Match:
cart
Then the following Magento URLs would be matched:
http://MAGENTO/checkout/cart
http://MAGENTO/my-cart-product
http://www.magento-cart.com/customer/account
As you can see, even the domainname matches here - one of the reasons to be very careful when using Partial Match. The Source URL is passed through here to a regular expression - people with PHP programming skills can perhaps make this even more useful by adding simple regular expressions to the Source URL. Note that the beginning and ending of the line (^ and $) do not work here. However, wildcards and (if|or|else) statements do work. Slashes are escaped.
Destination URL
The Destination URL can be any URL that you want the Source URL to be replaced with. If you start this URL with index.php?option= then MageBridge will translate this URL into a SEF URL. If it does not start with index.php?option= then the Destination URL will be used unmodified - you can enter the URL that you see in your browser addressbar, with or without the domainname. You can even use external sites (as if you would want that).
Example: Replacing the Magento homepage
One of the downsides of MageBridge is that the Magento homepage is used frequently by Magento itself and MageBridge does not offer a standard way to replace it. However, with URL Replacements you can replace the Magento homepage with the Joomla! content-page of your choice - a single Joomla! article or perhaps the Joomla! frontpage.
The clue is to enter as Source URL a / (forward-slash) and set the Source Type to Original Magento URL. Do not ever set the Source Type to Partial Match together with a Source URL that is very short - most likely you will replace all the Magento URLs and render MageBridge useless.
Example: Partial shutdown of your shop
When putting your MageBridge shop in maintenance, you have a couple of options. First of all, you could just take the entire Joomla! site offline. An alternative is to bring down only MageBridge, by setting the bridge offline within the MageBridge Configuration. But yet another option - if it fits your needs - is to temporarily disable the checkout, but not the catalog pages. This makes sure your rankings don't go down, but also that customers are not using the checkout-procedure while it is being modified.
For this to work, you'll want to disable the checkout pages: Create a new URL Replacement with as Source URL checkout and as Source Type the type Partial Match. This will replace any URL with the word checkout to the destination of your needs.
Example: Beautifying some empty Magento pages
By default, some Magento pages are very empty: When a customer finishes the checkout, the destination page is almost blank except for a small message that leads back to the homepage. This URL checkout/onepage/success could be replaced with some Joomla! article, giving much better suggestions for further shopping: You can even load module positions on that page to give entire listings of products.
Created on Wednesday, 27 October 2010Modified on Monday, 13 December 2010
More tutorials in this section
- Setting the MageBridge URLs in Magento
- Disabling user synchronization in MageBridge
- Importing and exporting users
- Using the MageBridgeLinks/JCE-plugin
- Best practices with MageBridge
- Using MageBridge Product Connectors
- Migrating users between Joomla! and Magento
- Using MageBridge stores to load a different Magento theme
- Using the MageBridge Content Plugin
- MageBridge SEO Guide
- Removing MageBridge
- Step-by-step: Adding a custom Magento block
- Managing MageBridge extensions
- How to use URL-suffices with MageBridge?
- Step-by-step: Create a Magento API user
- Step-by-step: Activating MageBridge plugins
- Step-by-step: Creating a MageBridge Menu-Item
- API permissions with MageBridge
- Configuring payment methods in MageBridge
- Using MageBridge modules
- Authentication guide for MageBridge
- Working with MageBridge URL Replacements
- Handling Downloadable Products in MageBridge
- Handling file uploads in MageBridge
- Configuring the MageBridge Root Menu-Item
- Setting MageBridge offline through the database
- How Joomla! works with MageBridge URLs
- Migrating MageBridge from Joomla! 1.5 to Joomla! 2.5
- Using the MageBridge System Plugin
