We did this by creating an operator that allows the product template to access a logged-in users purchase history. If the product ID was part of a successful order, then that user would see a different version of the product template that had no "add to cart" button, and instead displayed up to 3 file attributes for that product (though in practice you could have as many as you needed).
I will see if I can gather it up as a contribution.
One way of doing this is to use permissions with the following setup:
* Create a product which is dedicated to a specific download (or a subscription)
* Write a workflow event for the checkout process that checks (after payment) if the specific product for a download was bought. If that is the case then assign the user to an additional user group "product x download access"
* Create the actual download files in a location which is restricted (e.g. assign it to a new section) * Define the roles for the user group "product x download access" so that the user has permission to download the specified file(s)
This is a very clean way of enabling downloads and you basically only have to write a new workflow event to assign the user group after payment, the rest is configuration you can do via the admin GUI.
Thank you for sharing your solution. I also have a similar need.
@ Mark
With your solution, does anyone who knows the URL of the file to download can potentially download it even if the product was not bought (although it will require the user to be logged in).
@ Bård
If I understand properly your solution, it might not be easy to use as soon as there are hundreds or even thousands of different downloadable products. Would you suggest in that case to automatically create the sections and roles as soon as we create a product ?
That is a good question. We did not test that as our use case was low-traffic (and low budget!). The download links might not require permissions because it is only a template switch that prevents them from being exposed normally, not a permissions-based rule.
Also, the download link for the extension is now posted in the projects section: http://projects.ez.no/tc_mypurchases/downloads