Hello!

I needed the possibility of attaching more than one file to a file product; while most of the times this can be solved by simply putting all the files in one zip archive, it is highly inconvenient for audiobooks which are split in mp3 files (for instance one mp3 file per chapter). And using the parcel module would also be a bad solution, as you don't want to list individual chapters as sellable items.

So, the solution I came up with is a small patch which allows the file path entered by the user in the product creation page to be a directory. In fact, the only changes are about displaying the product for download (in the "My files" section): if the file is recognized to be a directory, it is scanned and all its contents (expect those starting with a '.') are made available for download.

For example, you could have a filesystem structured like this (supposing that "files" is the base directory for the ecommerce file module):

/files/Product1.txt
/files/Product2/Part1.txt   |
/files/Product2/Part2.txt   |  <- patch allows these file to be downloaded
/files/Product2/Part3.txt   |     when customer purchases Product2
/files/Product3.txt

The patch seems to work properly, but maybe the graphical layout of the downloadable files could be improved.

CommentFileSizeAuthor
file_allowdir.patch3.24 KBmardy78

Comments

gordon’s picture

Status: Needs review » Closed (won't fix)

We are not taking any new patch for the 3.x series. However the ec_file module in v4.x does support multiple files.

esadot’s picture

mardy78: you might find http://drupal.org/node/195869 entertaining, and while we're at it http://drupal.org/node/172845