Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Creating download files from item selected use GZIP?


Recommended Posts

Anyone konw one might accomplish this?


If I have 80 products, each with 10 items, rather than store the individual products already zipped, I would like to store them in seperate files.


This would allow someone to create their own custom download product.


The downloads in the catalog work perfectly but this enhanced way would allow people to create their own download list.


Single products could then be bundled.


It a music situation, someone could create their own collection or an album that has a couple of the same songs as another one could use the single copy of the song to include. This way the space required to store the files would be reduced.

Link to comment
Share on other sites

Yes, you could do this. Would require code changes to handle. Probably not difficult ones, but you would need to process everything at the time of download. Won't work on some hosts (the same ones that have problems with compressed backups won't work here).


One thing though, why would you gzip music? If it is stored as an mp3 (or practically anything other than a .wav), then it is already compressed--gzip won't do much with it.


If you want to create an archive that would use a different utility than gzip, which only handles compression (that's why linux archives frequently end .tar.gz: tar archives; gzip compresses). There is a pkzip compatible on many systems that will make the archives.


It would end up looking something like this (mostly in pseudocode):

$archive_command='/usr/bin/zip ';

foreach $product in cart {

 $archive_command .= $product['name_of_file'] . ' ';


$error_filename = tempnam(TEMP_DIR, DOWNLOAD_PREFIX);

$archive_command .= '> ' . $filename_to_be_downloaded . '2> ' . $error_filename;


if (filesize($error_filename) > 0) {


} else {





Link to comment
Share on other sites


I failed to mention that the product is a combination of MP3' and PDF's.


Each series has a listening sone, a accompaniment song, and a PDF of the sheet music. Pretty cool.


Currently we have 5 songs per series. (BIG download file), the customer is considering selling as singles if the logic to store each single, (listening song, accompaniment, PDF) would allow the end user to select the series and the programming create the series.


No problem with selling the singles since we started the bundles this way. Problem is creating the series, or what I am working on is offering a link to all of the singles upon purchase of the series. So 5 download links or 1 BIG download.


I will work with your great suggestion.



Link to comment
Share on other sites

Now to determine how to associate a series (CD) to all the individual files.


We are storing the products with product numbers. I just split the series (CD) named BT11-061.zip to 5 files BT11-061-1.zip, BT11-061-2.zip, BT11-061-3.zip, BT11-061-4.zip and BT11-061-5.zip.


I am storing then in download/61. Now I will have 5 directories 61 - 66 with 5 seperate zip files in each.


A customer orders BT11-061-1.zip, no problem they download the BT11-061-1.zip from the download directory.


Now if they order BT11-061.zip I need to package (zip) the 1-5.zip files together or make them all appear as downloads.


Has anyone tried to add multiple files to the attribites area, just thinking that might work as an alternative?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...