Commerce File 2.x extends Commerce License with the ability to sell access to files.
See the Commerce License documentation page for explanation of its basic concepts.
Getting started
- Setup your private file system path at admin/config/media/file-system.
- Enable the module and its dependencies.
- Go to admin/commerce/config/license/general and select the product and line item types that should be licensable.
- Switch to the File tab (admin/commerce/config/license/file) and select the product types that will be used to sell the file licenses.
If you have no other license types, then select the same product types you selected on admin/commerce/config/license/general.
This will create a commerce_file file field on each of the selected product types. - Go to each of the selected product types, and edit the created commerce_file file field. Configure the allowed file extensions and maximum allowed file size.
- If you want the customer to be able to download purchased files right from the checkout complete screen, go to admin/commerce/config/checkout and move the License completion message checkout pane into the "Checkout complete" group.
- Create a product, select the File license type, upload files that should be licensed.
That's it! Customers will be able to purchase the product, and later see all of their purchased file licenses on user/[uid]/my-files.
Important: Make sure authenticated users have the "view any product of any type" permission, otherwise they won't be able to see their files on user/[uid]/my-files.
Difference between Commerce File 1.x and 2.x
- 1.x implemented all of the licensing logic. This logic has now been generalized and moved into the Commerce License project.
- 1.x used a custom commerce_file field type for storing licensable files. 2.x uses a normal file field. This allows for compatibility with other contrib modules (such as File Entity) and decreases the amount of code in the commerce_file module.
- 1.x implemented its own tracking and counting of file downloads. 2.x provides this functionality through optional integration with the File download count module. This allows the number of downloads per file to be limited.
- 1.x allowed the number of ip addresses that can access a licensed file to be limited. 2.x removes this functionality, believing that it is redundant in the age of multi-device media consumption.
- 1.x recorded the purchased files on the license. If the files on the product changed (because the store admin added a new file version, for instance), a manual sync operation had to be invoked to update all of the licenses. 2.x always provides access to the latest files on the product.
File Entity integration
File Entity provides a better file experience on Drupal 7.
If it is enabled, Commerce File will integrate with its File Access API and use its file/%file/download callback instead of relying on its own.
File download count integration
File download count provides an API for tracking file downloads.
It records the uid, ip address and timestamp of each download.
The tracking happens only when the download link is used (file/%file/download), allowing downloads to be tracked separately from
file views (such as viewing an image stored on the private filesystem).
The download link is used by the "Commerce file" formatter provided by commerce_file, and by the File Entity formatters (such as "Download link").
If this module is enabled, a setting on em>admin/commerce/config/license/file allows the admin to configure the maximum number
of downloads for each licensed file. Once that download limit has been breached, the customer will not be able to download the file anymore
(user/[uid]/my-files will show the file, but without the download link. That is also done by the "Commerce file" formatter).