How can Magento be configured to deliver downloadable products from a sub-domain.





Note: the store is configured so that downloadable links cannot be shared, i.e. the customer must be logged in his own account to download the product.



Start of by adding a second storeview with new urls. This example focuses on 1 store.

  • goto System / Stores
  • create a storeview Downloads (set download as code)
  • goto System / Configuration / General->Web
  • set the correct base urls for secure and unsecure

You can play with the Session cookie management to make crossdomain cookies so the users do not have to login if it is under the same domain.

Replace downloadable links

Now you have to lookup the places where the downloadlink is generated: There are two locations I found important:

  • app/code/core/Mage/Downloadable/Block/Customer/Products/List.php for the customer list page
  • app/code/core/Mage/Downloadable/Block/Sales/Order/Email/Items/Order/Downloadable.php in the e-mails

Create a custom module and rewrite the download functions:

Downloads on account page

class Custom_Downloadable_Block_Downloadable_Customer_Products_List
        extends Mage_Downloadable_Block_Customer_Products_List

     * Return url to download link
     * @param Mage_Downloadable_Model_Link_Purchased_Item $item
     * @return string
    public function getDownloadUrl($item)
        return $this->getUrl('*/download/link', array(
                'id' => $item->getLinkHash(),
                '_secure' => true,
                '_store' => 'download' /* Use download store */


Downloads in e-mail links

class Custom_Downloadable_Block_Downloadable_Sales_Order_Email_Items_Order_Downloadable
        extends Mage_Downloadable_Block_Sales_Order_Email_Items_Order_Downloadable {

    public function getPurchasedLinkUrl($item)
        return $this->getUrl('downloadable/download/link', array(
                'id'        => $item->getLinkHash(),
                '_store'    => 'download', /* Always download from download store */
                '_secure'   => true,
                '_nosid'    => true


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.