Magento – Selling link to an external site as product

downloadablemagento-1.9productvirtual-products

We want to include some products which are actually held in an external site – however, they're not files, just pages within the external site. The external site manages authentication, access etc. and we just want to use Magento to sell a product which consists of a link to the remote site.

Downloadable products seemed to be the best option, but these are tailored towards downloadable files and so try to download a file from the supplied link.

Any suggestions on how we can do this?

Best Answer

Downloadable products are made for this. You can choose between an uploaded file or an URL for each downloadable item of the product:

Screenshot

Update: I was wrong

Magento proxies a download to the given URL instead of redirecting the customer, so some customization is necessary. I would still go with the downloadable product and add a new download type besides "File" and "URL", let's call it "Redirect"

  1. Define new link type

    Edit the form HTML in app/design/adminhtml/default/default/template/downloadable/product/edit/downloadable/links.phtml (copy the file to a custom admin theme and modify it). Create a new option for the downloadable[link][{{id}}][type] input called "redirect" (below "file" and "url"). There might be a more elegant way to change the template without this override, using JavaScript instead.

  2. Handle new link type

    Create a new controller for the "downloadable" route, using before="Mage_Downloadable" to override Mage_Downloadable_DownloadController::linkAction(). I would extend the original controller and just override the _processDownload($resource, $resourceType) method with something like this:

    protected function _processDownload($resource, $resourceType)
    {
        if ($resourceType === 'redirect') {
            //TODO: redirect to $resource
            return;
        } else {
            return parent::_processDownload($resource, $resourceType);
    }
    
Related Topic