Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Downloads on another site


Guest

Recommended Posts

Posted

I have several sites and would like to spread the workload and file size across multiple sites. I want to allow downloads from other servers.

 

If I setup an item as a downloadable item on my server it works fine, but when I want it from another server the link is not displayed.

As a person checks out he is displayed the link to download, ok if file is in my download folder but not if it is a URL. I checked downloads.php and found the following code.

 

// The link will appear only if:

// - Download remaining count is > 0, AND

// - The file is present in the DOWNLOAD directory, AND EITHER

// - No expiry date is enforced (maxdays == 0), OR

// - The expiry date is not reached

     if ( ($downloads['download_count'] > 0) && (file_exists(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'])) && ( ($downloads['download_maxdays'] == 0) || ($download_timestamp > time())) ) {

 

Nicely commented and thought this would be easy remove the check for file_exists and all set

as Below:

 

// The link will appear only if:

// - Download remaining count is > 0, AND

// - The file is present in the DOWNLOAD directory, AND EITHER

// - No expiry date is enforced (maxdays == 0), OR

// - The expiry date is not reached

     if ( ($downloads['download_count'] > 0) && ( ($downloads['download_maxdays'] == 0) || ($download_timestamp > time())) ) {

 

However there is no joy in Mudville there is still no link to download.

 

so obviously I am wrong and that will not stop the checks to see if the file exists. so I started looking at the alternative adding the link in the failed option. but prefer to do it correctly

 

   echo '            <td class="main"><a href="' . tep_href_link(FILENAME_DOWNLOAD, 'order=' . $last_order . '&id=' . $downloads['orders_products_download_id']) . '">' . $downloads['products_name'] . '</a></td>' . "n";

     } else {

       echo '            <td class="main">' . $downloads['products_name'] . '</td>' . "n";

     }

 

If you have the answer to my question, please layout what I was doing wrong as I prefer to learn from my mistakes :wink:

Posted
the link is not displayed

Do you mean nothing appears, or the name appears as text?

 

Your modification seems reasonable to me (but I wrote that code a long time ago...)

 

Did you check the other parameters (# of downloads, date...)

Christian Lescuyer

Posted
Do you mean nothing appears, or the name appears as text?

 

Sorry it was kinda late, The name and date and # of downloads showed up as text, Just not the actual Link code. As if it still failed the qualifications.

 

other than being in my downloads folder yes it qualified, new item and hadn't been downloaded.

 

 

Thanks.

Posted

Strange. Let's skip the finesse stage...

Can you try something like:

print '<pre>';

print_r($downloads);

print $download_timestamp;

print '</pre>';

Christian Lescuyer

Posted

:D

 

Got it. Not sure why it would not display before, but have fixed the problem. it now displays and downloads from the other site.

 

in downloads.php I modified the code to this:

// The link will appear only if:

// - Download remaining count is > 0, AND

// - The file is present in the DOWNLOAD directory, AND EITHER

// - No expiry date is enforced (maxdays == 0), OR

// - The expiry date is not reached

      if ( ($downloads['download_count'] > 0) && ( ($downloads['download_maxdays'] == 0) || ($download_timestamp > time())) ) {

          echo '            <td class="main"><a href="' . $downloads['orders_products_filename'] . '">' . $downloads['products_name'] . '</a></td>' . "n";

     }

     else {

       echo '            <td class="main">' . $downloads['products_name'] . '</td>' . "n";

     }

?>

 

and in product attributes I put the complete url of the file as the filename.

 

One little thing to take care of and it is all set. These are free driver downloads, so I have the pricec set to 0 now I need to skip the payment options screen.

 

But thats a whole different subject.

Thanks for your help

  • 4 weeks later...
Posted

Yes this does work

 

But I find that it doesnt count down how many times the user has clicked download to get the file

 

Thereofre the user can download as many times as they like obviously using bandwidth which you dont want

 

Anyone have a fix for this?

  • 1 year later...

Archived

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

×
×
  • Create New...