Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problem with downloadable Products


karinha

Recommended Posts

Hello,

 

well here is my problem: I want to set up a shop with MP3s and lead sheets to download. At the beginning I had uploaded the MP3s as a m4a file and it was working fine. Then I had read that it should be a zip file so I added zip on the end and I fooled around in my configure php file and my download php file (following instructions on a post about downloadable products). Well I wished i would have never started changing anything because since it is not working anymore. In the meanwhile (after changing the name of the download directory - which is now called download directory again) i was not even able to see my catalog page online - I fixed that one. I think i reseted everything back to the way it was at the beginning, but I get following error message when i try to download my product after purchase:

 

Not Found

The requested URL /catalog/pub/.ztvdlrdztuggdwiqj/funkstreet.zip was not found on this server.

 

Additionally, a 404 Not Found error was encountered while trying to use an Error Document to handle the request.

 

This is how my configure.php file in catalog/includes looks like

define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');

define('DIR_FS_CATALOG', '/home/html/catalog/');

define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');

define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

 

So the Internet should be looking for my files in the download directory, or not? why does it search it in the pub directory? Is there a mistake in mt configure.php file?

 

I looked if I can access my download folder through the link...nob. It asks me for a username and password, when i put in what I have for my admin folder, it doesn't work. There is a .htaccess file in my download folder with following text:

AuthType Basic

AuthName "No access"

AuthUserFile .htnopasswd

AuthGroupFile /dev/null

Require valid-user

 

Is that normal? Should this .htacces file be there? Do I have to change anything in that one?

 

I am running nuts over this here and already lost several days on it. I would be so incredibly happy and thankful if somebody could guide me through this. I searched the Forum up and down, but was not able to find anything that helped me solve my problem.

 

Another question: In how far is this Download Controller helpful and needed??? My download works fine in theory (I only get the download link after paying), only that it doesn't find my downloadable file...

 

Thanks a lot in advance for your help!

 

Karin

Link to comment
Share on other sites

Not Found

The requested URL /catalog/pub/.ztvdlrdztuggdwiqj/funkstreet.zip was not found on this server.

 

Additionally, a 404 Not Found error was encountered while trying to use an Error Document to handle the request.

 

 

.ztvdlrdztuggdwiqj where is this coming from.

if your funkstreet.zip is in oub folder.

 

Just check and You may get the answer.

else post more details.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

// if the order contains only virtual products, forward the customer to the billing page as

// a shipping address is not needed

if ($order->content_type == 'virtual') {

if (!tep_session_is_registered('shipping')) tep_session_register('shipping');

$shipping = false;

$sendto = false;

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

}

 

this should have got executed and the code should have been redirected to checkout_payment

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

Not Found

The requested URL /catalog/pub/.ztvdlrdztuggdwiqj/funkstreet.zip was not found on this server.

 

Additionally, a 404 Not Found error was encountered while trying to use an Error Document to handle the request.

.ztvdlrdztuggdwiqj where is this coming from.

if your funkstreet.zip is in oub folder.

 

Just check and You may get the answer.

else post more details.

 

Satish

 

Dear Satish,

 

First of all thanks a lot for your reply!

My funkstreet.zip is in the download folder not in the pub folder. Should it be in the pub folder? I really don't know where those funky letters come from. The only thing that's in my pub folder is an .htaccess file with following content: Options +FollowSymLinks -Indexes

 

What other details would you need? do you need my download.php file content? I attached that in the p.s.

 

I just cliqued on my funkstreet.zip and it tells me that the compressed file is either not valid, or corrupt. Maybe that's the point here. honestly I have to admit I had no clue how to do the zip file I just added .zip at the end - is that the way to go for it? sorry i am really a newbie on that area... :blush:

 

I didn't really understand your second reply... I only get the download link after paying with the sample creditcard, so that is working fine, right?

 

I am really thankful for your help and time on that!

 

Karin

 

P.S.: voila this is my download.php file:

 

<?php

/*

$Id: download.php,v 1.9 2003/02/13 03:01:48 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

include('includes/application_top.php');

 

if (!tep_session_is_registered('customer_id')) die;

 

// Check download.php was called with proper GET parameters

if ((isset($HTTP_GET_VARS['order']) && !is_numeric($HTTP_GET_VARS['order'])) || (isset($HTTP_GET_VARS['id']) && !is_numeric($HTTP_GET_VARS['id'])) ) {

die;

}

 

// Check that order_id, customer_id and filename match

$downloads_query = tep_db_query("select date_format(o.date_purchased, '%Y-%m-%d') as date_purchased_day, opd.download_maxdays, opd.download_count, opd.download_maxdays, opd.orders_products_filename from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " opd where o.customers_id = '" . $customer_id . "' and o.orders_id = '" . (int)$HTTP_GET_VARS['order'] . "' and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_download_id = '" . (int)$HTTP_GET_VARS['id'] . "' and opd.orders_products_filename != ''");

if (!tep_db_num_rows($downloads_query)) die;

$downloads = tep_db_fetch_array($downloads_query);

// MySQL 3.22 does not have INTERVAL

list($dt_year, $dt_month, $dt_day) = explode('-', $downloads['date_purchased_day']);

$download_timestamp = mktime(23, 59, 59, $dt_month, $dt_day + $downloads['download_maxdays'], $dt_year);

 

// Die if time expired (maxdays = 0 means no time limit)

if (($downloads['download_maxdays'] != 0) && ($download_timestamp <= time())) die;

// Die if remaining count is <=0

if ($downloads['download_count'] <= 0) die;

// Die if file is not there

if (!file_exists(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'])) die;

 

// Now decrement counter

tep_db_query("update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_count = download_count-1 where orders_products_download_id = '" . (int)$HTTP_GET_VARS['id'] . "'");

 

// Returns a random name, 16 to 20 characters long

// There are more than 10^28 combinations

// The directory is "hidden", i.e. starts with '.'

function tep_random_name()

{

$letters = 'abcdefghijklmnopqrstuvwxyz';

$dirname = '.';

$length = floor(tep_rand(16,20));

for ($i = 1; $i <= $length; $i++) {

$q = floor(tep_rand(1,26));

$dirname .= $letters[$q];

}

return $dirname;

}

 

// Unlinks all subdirectories and files in $dir

// Works only on one subdir level, will not recurse

function tep_unlink_temp_dir($dir)

{

$h1 = opendir($dir);

while ($subdir = readdir($h1)) {

// Ignore non directories

if (!is_dir($dir . $subdir)) continue;

// Ignore . and .. and CVS

if ($subdir == '.' || $subdir == '..' || $subdir == 'CVS') continue;

// Loop and unlink files in subdirectory

$h2 = opendir($dir . $subdir);

while ($file = readdir($h2)) {

if ($file == '.' || $file == '..') continue;

@unlink($dir . $subdir . '/' . $file);

}

closedir($h2);

@rmdir($dir . $subdir);

}

closedir($h1);

}

 

 

// Now send the file with header() magic

header("Expires: Mon, 26 Nov 1962 00:00:00 GMT");

header("Last-Modified: " . gmdate("D,d M Y H:i:s") . " GMT");

header("Cache-Control: no-cache, must-revalidate");

header("Pragma: no-cache");

header("Content-Type: Application/octet-stream");

header("Content-disposition: attachment; filename=" . $downloads['orders_products_filename']);

 

if (DOWNLOAD_BY_REDIRECT == 'true') {

// This will work only on Unix/Linux hosts

tep_unlink_temp_dir(DIR_FS_DOWNLOAD_PUBLIC);

$tempdir = tep_random_name();

umask(0000);

mkdir(DIR_FS_DOWNLOAD_PUBLIC . $tempdir, 0777);

symlink(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'], DIR_FS_DOWNLOAD_PUBLIC . $tempdir . '/' . $downloads['orders_products_filename']);

tep_redirect(DIR_WS_DOWNLOAD_PUBLIC . $tempdir . '/' . $downloads['orders_products_filename']);

} else {

// This will work on all systems, but will need considerable resources

// We could also loop with fread($fp, 4096) to save memory

readfile(DIR_FS_DOWNLOAD . $downloads['orders_products_filename']);

}

?>

Link to comment
Share on other sites

Ok never mind the question about how to properly zip a file. I figured that out, but now I don't even receive a link to download... My option name is: download, my option value: yes. I grant five download trials and 7 expire days. I tried setting the download redirect on false and on true - no difference, no link in both cases!

 

I'd really appreciate your help!

 

Karin

Link to comment
Share on other sites

Ok never mind the question about how to properly zip a file. I figured that out, but now I don't even receive a link to download... My option name is: download, my option value: yes. I grant five download trials and 7 expire days. I tried setting the download redirect on false and on true - no difference, no link in both cases!

 

I'd really appreciate your help!

 

Karin

 

I do have a link again, but the same error message as above, when download redirect on true: The requested URL /catalog/pub/.qfuhgirszngwtgmm/funkstreet.zip was not found on this server.

 

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

 

When it is on false, I get a blank page... :'(

Link to comment
Share on other sites

  • 4 weeks later...
I do have a link again, but the same error message as above, when download redirect on true: The requested URL /catalog/pub/.qfuhgirszngwtgmm/funkstreet.zip was not found on this server.

 

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

 

When it is on false, I get a blank page... :'(

 

I am having a similar problem and I am getting extremely frustrated that no one can seem to answer this question. I have done everything suggested and basically with redirect off I get the zip file to download but it stops before it finishes. I started a thread about this and got a solution but this was to set download to redirect, now that it is set to redirect Firefox says that it cannot connect to the server. I have all the proper permissions, everything is spelled right, etc etc. All the little things are in place, just this last little (meaning huge) that is keeping my site from going live FOR WEEKS now. Our launch is now 3 weeks overdue and well, its all business lost.

 

The best of luck.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...