Forums / Developer / Webshop - downloadable products
Michal Slocinski
Tuesday 28 April 2009 11:07:30 am
Hi all,
I would like to setup a site with webshop and downloadable products. After making a payment, user should be allowed to download particular file.
I've been looking into the documentation and forum as well, but information I found is quite old so maybe there are already easier ways of achieving such result. In general, authors recommend one of below approaches: a) "hide" URL without protecting itb) develop custom extension and create single roles for each of products, extension would then assign user to particular role after successful payment
Is there any other approach you would recommend in order to implement described functionality?
Michal
Mark Marsiglio
Tuesday 05 May 2009 8:44:15 am
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.
http://www.thinkcreative.com Turning Ideas Into Strategic Solutions
Bård Farstad
Tuesday 05 May 2009 9:31:19 am
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.
Hope this helps,
-bård
Documentation: http://ez.no/doc
Hakim Bouras
Wednesday 06 May 2009 2:21:41 am
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 ?
Thanks for your help,Hakim
Łukasz Serwatka
Wednesday 06 May 2009 5:02:19 am
Hi,
You might also look on the examples in solutions category:http://ez.no/developer/contribs/solutions
For example:http://ez.no/developer/contribs/solutions/ib_paid_download_link
Personal website -> http://serwatka.net Blog (about eZ Publish) -> http://serwatka.net/blog
Wednesday 06 May 2009 12:57:16 pm
@Hakim -
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
Thursday 07 May 2009 3:34:48 am
Thanks Mark for sharing your operator.
The solution pointed by Lukasz also looks very interesting.
Cheers,Hakim