Setting the MageBridge URLs in Magento - Yireo

Handling Downloadable Products in MageBridge

MageBridge is able to integrate many things of Magento into Joomla! - the entire Magento frontend is integrated neatly into the Joomla! template and various other integrations make setting up a Magento site a breeze. One of the areas where the MageBridge functionality becomes a bit hard is the area of Downloadable Products. This tutorial gives you insight in the ups and downs.

Introducing Magento Downloadable Products

Magento offers the ability to sell downloads - this is done through the product-type Downloadable Product. For every Downloadable Product, a number of links can be created: Either by uploading a file or by pointing to an existing file on the filesystem of the webserver. A link can be sold separately - for instance, you can offer one product with multiple links, so the customer decides which link he wants and which not.

Also, a link can be set to be Shareable - meaning that the download-link is accessible without the requirement of logging in. The upside is that it requires less steps on the side of the user to access the purchased download. The downside is that the security is gone.

Bridging download-links

MageBridge is able to bridge any download that occurs from Magento to Joomla!. However, because not only the body of every download is significant but also the header, MageBridge needs to fully download each file before it can be transferred to the client (browser). With small downloads this is no problem, but with large downloads (bigger than 100Mb) this becomes an issue: Every file is first downloaded from Magento to Joomla! (during which the visitor has to wait for the server to respond) and only after that, the actual download of the client starts.

To prevent this from happening, the MageBridge module in Magento has an extra option Bridge Downloads which can be set to No. This means that the download-link will be using the Magento URL instead of the Joomla! URL. While this results in a faster download, it also adds a requirement to the download-link. The Magento download-link has to be configured either as shareable, or you need to make sure Single Sign On is working at all times. If you bump into this limitation, we recommend to set the link to shareable or to look for alternatives (like the DOCman approach below).

Please note that a wrong configuration of mod_deflate causes downloads to have problems under IE sometimes. We have released a tutorial for Magento to help the community solve this problem. The tutorial also applies to MageBridge, except that the htaccess-file in Joomla! needs to be modified instead.

Replacing Downloadables with Joomla! downloads

Every time a Downloadable Product is sold, details of the Downloadable Product are copied to a special customer table. This is important to note, because it means that if you modify the original Downloadable Product, customers who have already purchased the product will not benefit from these changes: If a customer buys a product with download A, and afterwards you change download A into B, or you add an extra download C to the same product, the customer will still be able to download A - not B or C.

These limitations can be bypassed by replacing Magento Downloadable Products with a Joomla! mechanism. MageBridge includes for instance a Product Connector for DOCman, which makes it possible to add every customer who purchases a specific Magento product to a specific DOCman Group. After this, you can use the DOCman Group to grant access to specific downloads. Instead of selling specific downloads, you can use MageBridge and DOCman to sell access to a download-folder - no matter what is placed in that folder.

Using this solution, you can sell DOCman access without any intermediate steps. MageBridge automates the entire process. The MageBridge Product Connector for DOCman is included with the core MageBridge distribution.

Troubleshooting downloads

When everything in MageBridge works fine, but the Downloadable Products do not, make sure to pay attention to the following:

  • PHP version: Make sure your PHP version meets up with the proper requirements of both Joomla!, Magento as MageBridge. Outdated PHP versions might cause problems, so it's best to keep your PHP installation up-to-date (for stability and security). 
  • libcurl version: When you update PHP, make sure you also update the libcurl library on your system. Try to keep libcurl up-to-date.
  • Beware of mod_deflate: When adding Apache mod_deflate rules to your environment (either through Apache configuration or htaccess-rules) do not apply mod_deflate to all files, but only to plain-text files that need compression. Do not enable the DEFLATE-filter by default, but only apply it those MIME-types that need it (text/html, application/xml, text/css, etcetera). In case of emergancy you can always try to add the E-tag E=no-gzip:1 to your htaccess-files - for instance specifically for the MageBridge download-URLs.
  • Beware of mod_expires: When adding Apache mod_expires rules to your environment, do not set the default expiry-time to something stupiduous like 1 year. Our advise is to set the expiry-time to 0 (ExpiresDefault A0) and then apply specific expiry-times to specific MIME-types.
Created on Thursday, 25 November 2010
Modified on Thursday, 10 March 2011

About Yireo

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

More about Yireo