Jump to content
Sign in to follow this  

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.

Share this post

Link to post
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 {





Share this post

Link to post
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.



Share this post

Link to post
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?

Share this post

Link to post
Share on other sites

Wow, how do you update the attributes?


I need a better way to find product_id=10. I have 19 pages of Product Atttibutes.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this