EnablingTo start selling files, you need to make sure you have enabled the File Downloads module. The File Downloads module makes use of Ubercart's product feature system that lets you attach additional features to products (e.g. file download or discount). You can enable the module under Administer â€º Site building > Modules. Check the box next to File downloads and press the "Save settings" button.
PermissionsAfter enabling the module, you'll want to set the permissions on who can access what parts of the module. You can do this by browsing to Administer â€º User management > Access control. This form will show you all the roles on your Drupal configuration and what permissions they have. You will want to scroll down to the permissions for the uc_file module. There are 2 permissions, "download file" & "view all downloads". The "download file" permission will allow a user to download files from the store. More than likely, you'll want to enable this permission for everyone (you might not want to check the permission for anonymous user if you want customers to be logged in before they can download files) The "view all downloads" permission will let a user view any files a customer has purchased by looking at their user page. You will only want to grant this role for a site or store administrator role.
SettingsYou will also need to set up the file downloads directory that will be used to store all the digital products you will be selling for your store. If you haven't set it (or Ubercart can't find the directory you have specified), you will see a warning on the Store administration page (Administer > Store administration).
If you're perhaps wondering why you should have to specify a file download directory instead of using Drupal's files directory, a separate directory is needed for security reasons; specifying a directory outside of your web root prevents the possibility of someone figuring out where your files are stored and downloading them directly off your web server instead of paying for them. The file downloads directory is set up under Administer â€º Store administration â€º Configuration > Product settings > Product features. You should see a link that says File download settings, after clicking the link it should open up a form to specify settings for file downloads. It's here where you'll see the following settings:
- Files path
- This is the file directory for file downloads is specified. The path can be absolute (e.g. "C:\WWW\downloads" (Windows), "/www/downloads" (Linux)) or relative to Drupal root (e.g. "../downloads"). If you were insistent on using the Drupal file directory for downloads you could specify "files/downloads" as the path (assuming "files" was the name of your Drupal files directory and the directory "downloads" existed within that directory).
- If you wish to impose a limit on the number of times that a user can download a file purchased, you can specify it here. Leaving the field empty will set no limit on the number of downloads.
- IP addresses
- If you wish to prevent the number IP addresses that can access the file you can specify it here. Leaving the field empty will set no limit on the number of addresses.
- If you wish to specify an amount of time from when a file download granted that a user is allowed to download the file until expiration, you can set it here. By default, this is set to "never" which means there is no expiration on file downloads.
Adding FilesOnce your file download directory has been setup you're ready to start adding files to the directory so that they can be used for file downloads. There are two ways to do this. One is through the built in file manager located in Administer â€º Store administration â€º Products > View file downloads, this file manager shows all files located in your file directory (with products or SKUs are associated with them) and allows you to delete them or upload new files. Depending on your website's configuration, you might want to upload files that are too big for Ubercart to upload. In which case, you will have to use the second method, upload the files directly through a FTP/SFTP/SSH client to your file downloads directory. After uploading the files directly, they should appear in file manager.
Adding Files to ProductsFrom here you must associate your Ubecart products with file downloads. This tutorial assumes the reader already knows how create an Ubercart product. If you do not you can reference ubercart product creation. Once your product is created you should see a "Features" tab on the product edit page. After clicking the "Features" link, you'll see a empty list of product features. Select "File download" from the Add a new feature select box and click "Add".
The next step is to fill out the feature form with the following details:
- The Model/SKU of the product that grants the download. If the product you are selling is solely a download you'll want to keep this to "Any". If however the product you're selling has different SKU adjustments you might only want to grant a download on a specific SKU (e.g. a music album product might have 2 SKUs: one for the CD & for the album download).
- File download
- The name of the file (located in the file download directory) that can be downloaded upon purchase. Upon typing the file name, an auto complete box should appear showing the available files that start with the text typed. If there are any subdirectories in the file download directory, specifying a subdirectory here will grant all files within that subdirectory.
- A description of the file product. This text will be displayed alongside the file name on a customer's file download page.
- Shippable product
- This checkbox specifies whether the product associated with the download is shippable or not (if there are no shippable items in a customers order he won't be asked for a shipping address at checkout). If there is a shippable product included with this file download you will need to check this box, otherwise leave it blank.
Upon typing "Tes", the file download module recognizes there is a file called "Test.txt"