Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Download Link Not Working NEED HELP BADLY


mmontalbano

Recommended Posts

I am using an old version of OSC on my site but haven't been able to determine what version it is to refeence it here. My site is www.ebookfestival.com . When a customer buys a product it shows up in their account as a link but it isn't clickable. I have the products set up right in the Admin section, permissions set correctly, names of files are all straight but still I get no link. I read many of the posts on here but most refer to the Admin/Configuration/Download area in the admin panel. This version doesn't have that area. All products in this " template " are automatically set for download.

 

Is there an area in the php files that controls the downloadability of the files? What else can I check. This is driving me crazy. Could use help quickly!

 

Thanks

Matt

Link to comment
Share on other sites

I had loads of problems with download links not showing up and could not get answers anywhere. I now use a guy who fixes all my problems. There is an email link to the developer at the bottom of my home page. He may charge a small fee but I have found him invaluable. His name is Jason.

 

Hope that helps. Email me if you have any probs [email protected]

 

Regards

Russell

Link to comment
Share on other sites

I am using an old version of OSC on my site but haven't been able to determine what version it is to refeence it here. My site is www.ebookfestival.com . When a customer buys a product it shows up in their account as a link but it isn't clickable. I have the products set up right in the Admin section, permissions set correctly, names of files are all straight but still I get no link. I read many of the posts on here but most refer to the Admin/Configuration/Download area in the admin panel. This version doesn't have that area. All products in this " template " are automatically set for download.

 

Is there an area in the php files that controls the downloadability of the files? What else can I check. This is driving me crazy. Could use help quickly!

 

Thanks

Matt

 

 

The download code needs proper configuration.

 

chek what payment status needs to be achieved for download link to be shown.

See to it that in your payment module setting set a status equal or above wne payment is completed.

 

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

The download code needs proper configuration.

 

chek what payment status needs to be achieved for download link to be shown.

See to it that in your payment module setting set a status equal or above wne payment is completed.

 

Satish

 

 

I'm not sure where to begin looking in the download.php file? Here is what the code is currently:

 

<?php

 

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']);

}

?>

 

 

 

 

 

I really need to get this fixed today somehow. If anyone can help me I'll post whatever you need or even give you access to my Cpanel if you could take a look at the code and tell me how to fix.

 

Thanks

Link to comment
Share on other sites

Hope you got an answer for this, but if not...

You're looking at the wrong download.php page. There's another one under /includes/modules/download.php

Please note that my directory set up may be a little different because osCommerce is provided by my host and I think they have their own customized set up. Anyways, look in that download.php file. That one is the one actually querying the database for all valid download orders, etc and displays it onto the page.

Link to comment
Share on other sites

look at this(where conditions)

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 != ''"

 

So it implies

1)Filename should exist.

2)download maxdays

3)download count

 

so just chek whether the number off rows returned by this are not zero.

 

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

I am using an old version of OSC on my site but haven't been able to determine what version it is to refeence it here. My site is www.ebookfestival.com . When a customer buys a product it shows up in their account as a link but it isn't clickable. I have the products set up right in the Admin section, permissions set correctly, names of files are all straight but still I get no link. I read many of the posts on here but most refer to the Admin/Configuration/Download area in the admin panel. This version doesn't have that area. All products in this " template " are automatically set for download.

 

Is there an area in the php files that controls the downloadability of the files? What else can I check. This is driving me crazy. Could use help quickly!

 

Thanks

Matt

includes/application_top.php may have

 

// define the project version

 

under that, it may give your version of OSC. Mine now says

 

define('PROJECT_VERSION', 'osCommerce 2.2-MS2-060817');

 

because I edited it to reflect the OSC update 060817

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...