Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Link has already expired with Downloads


pegweb

Recommended Posts

I have the downloads controller by Linda and everything was working fine and still is if I manually select the order status as delivered after the customer has made a purchase.

 

The problem seems to come from the Link Expiry Date. After successfully ordering the product this is what is listed:

 

Link expires:

Thursday 02 December, 1999

 

3 downloads Remain

 

My Payment Module (Worldpay currently in testmode) is set to Processing.

Linda's Order Status Value for Downloads is set to 2

 

The file exists the folders are chmoded and I know everything is ok there because if I update the order status then the download link becomes active.

 

The order dates are correct its just the download expiry that is wrong.

 

Where does this date come from ? It always appears to be the same date ?

 

Last step before shop goes live any assistance would be greatly appreciated.

Link to comment
Share on other sites

Did anyone figure out a solution to this problem? I have the same issue with this Contribution; I can go through everything up to the finish and download screen. At that point, I see:

 

"Download your products here"

Then three table columns with (1) The file name (unlinked); (2.) Expiration date as Friday 03 December, 1999; and (3.) 3 downloads remaining.

 

None of that is a clickable link to download the file.

 

I am using the tep_snapshot-20030521.zip version if that helps.

 

Thanks,

 

Jim Smith

Link to comment
Share on other sites

Hello Jim,

sorry to hear you are having the same problem as me.

I still have not managed to solve this problem and it's paramount to my site going live.

I am using 2.2 MS 1

Strange that yours is always showing Friday 03 December 1999 a day past my expiry.

 

Are you using Worldpay ? If so have you got it in test mode ?

I'm glad in a way(sorry) that I am not alone with this problem. Help seems to have dried up altogether from the team, but I know they must be busy.

 

Perhaps we can try to get to the bottom of this.

Link to comment
Share on other sites

Thanks for the note of sympathy <grin>. No, I'm not using Worldpay. It is just manual credit cards for now. I'll let you know if I discover anything on it and appreciate if you do likewise.

 

Regards,

 

Jim Smith

Link to comment
Share on other sites

How many days download have you specified and how many attempts.

I have mine set at 2 max days 3 max downloads.

Been into the database at products_attributes_download and double checked that these vaules exist and they do.

 

Do your products have options e.g. download version/printed version.

 

Are your products zipped up ?

Link to comment
Share on other sites

I have 7 days download and 4 attempts. Update Status value is 4 and Order Status Value I've tried 1 and 2. With "1", I get the reply with the bogus date and such. Changing it to "2" means that it puts a note at the bottom that payment needs to be approved prior to downloading.

 

My products don't have the option for download version/printed version since the client wanted separate SKU's for each.

 

The PDF's are not zipped. Just about 1 to 1.5 meg files.

Link to comment
Share on other sites

I have PDF's aswell so I have zipped them up. Still no joy.

Tried product status as delivered for downloads and this time I get:

NOTE: Downloads are not available until payment has been confirmed.

 

I currently have the status set at 2 for Linda's and 2 for the other.

I have tried 3 and 4 and both on 3 still no joy.

 

My head is spinning over this.

Link to comment
Share on other sites

Just desperately trying and checking everything I found that the /tmp/ folder was set incorrectly.

Set this correctly and still downloads have expired:

Expiry date:

Thursday 02 December, 1999

 

I need to go live with this next week looks like I'll be trying another store product over the weekend as an alternative.

Link to comment
Share on other sites

It has to be somewhere in this from Linda's modules/downloads.php:

 

<?php

// 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())) ) {

// WebMakers.com Added: Downloads Controller Show Button

// original MS1 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";

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

} else {

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

}

?>

 

Maybe we have to uncomment the line starting:

// original MS1

Link to comment
Share on other sites

A response from Linda:

=============

From the looks of it, I'd say either your configure.php is using $DOCUMENT_ROOT instead of the real path or you have a bad filename or a missing file.

=============

I checked my include/configure.php and didn't find $DOCUMENT_ROOT but found DIR_FS_DOCUMENT_ROOT which references the correct path. I dunno if that is a clue or not. Regarding bad filenames or missing files, I've tried to revisit the steps and recheck each file but without success.

 

Anyone else with some insight?

 

Thanks,

Jim Smith

Link to comment
Share on other sites

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

define('DIR_FS_DOCUMENT_ROOT', '/home/httpd/vhosts/cornershop.co.uk/httpdocs/');

define('DIR_FS_CATALOG', '/home/httpd/vhosts/cornershop.co.uk/httpdocs/shop/');

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

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

 

Download and Pub are chmod 755

The files exist - the names are correct - the files are zipped

 

Every path and file name must surely be ok because if I update the order status the links appear ?

 

Hope you can help Linda.

Link to comment
Share on other sites

Ok tried removing the full path for DIR_FS_DOCUMENT_ROOT and using $DOCUMENT_ROOT - store works with either but still the same expired download.

 

Removed the expiry date from the product attribute (Expiry days: 0)

 

And now the link works when purchasing a product.

 

I really need an expiry date for all downloads though.

 

['download_maxdays'] == 0) || ($download_timestamp > time())) )

 

download maxdays is equivalent to download timestamp

 

 

It appears that the problem lies in mktime on some servers so from Linda's modules/download.php and indeed in OS 2.2 MS1 modules/download.php maybe this is causing the problem:

 

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

$download_expiry = date('Y-m-d H:i:s', $download_timestamp);

 

 

Ran this on my server as a mktime test:

<?

$datefromdb = $guest['guest_time'];

$year = substr($datefromdb,0,4);

$mon = substr($datefromdb,4,2);

$day = substr($datefromdb,6,2);

$hour = substr($datefromdb,8,2);

$min = substr($datefromdb,10,2);

$sec = substr($datefromdb,12,2);

$orgdate = date("l F dS, Y h:i A",mktime($hour,$min,$sec,$mon,$day,$year));

?>

Date: <? echo $orgdate; ?>

 

This returns a value of Date: Thursday January 01st, 1970 12:59 AM

 

Then rang this:

<?php

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

?>

TIMESTAMP RESULTS: <? echo $download_timestamp; ?>

 

Returns a value of -1

 

Which equates to Wednesday, December 31st 1969, 23:59:59 (GMT)

 

 

Hope Harald can shed some light on this for us.

Link to comment
Share on other sites

Hi I am also getting this problem. Please help if anyone has the answer. I even have my expiry date set to 0 and I still get the following:

 

Expiry date:

Sunday 05 December, 1999

 

I dont mind having no limit on days of expiry but Im still getting this date, anyhelp? :(

Link to comment
Share on other sites

Just out of curiousity, on what kind of servers are you running? Linux/Microsoft, IIS/Apache and what versions of those and PHP?

 

What does

<?php 

$download_timestamp = mktime(23, 59, 59, 6, 1, 2003, 1); 

?> 

TIMESTAMP RESULTS: <? echo $download_timestamp; ?>

do? It should return something like 1054526399.

 

Good luck,

Matt

Link to comment
Share on other sites

Just out of curiousity, on what kind of servers are you running?  Linux/Microsoft, IIS/Apache and what versions of those and PHP?

Apache server running FreeBSD 4.4 and PHP Version 4.1.2

 

What does
<?php 

$download_timestamp = mktime(23, 59, 59, 6, 1, 2003, 1); 

?> 

TIMESTAMP RESULTS: <? echo $download_timestamp; ?>

do?  It should return something like 1054526399.

Matt,

Yes, I get:

"TIMESTAMP RESULTS: 1054533599"

but I'm still getting the old 1999 expiry date. Any ideas?

 

Thanks,

 

Jim Smith

Link to comment
Share on other sites

  • 4 weeks later...

OK I was wondering if anyone had sorted this problem out - I have major headaches with this and I to am getting the december 1999 date and no download link - I will say that everything worked fine until I added the IPN for Paypal feature - now I get no link to download but everything else updates etc - I REALLY need some quick help to resolve this and I am prepared to pay $50 to the person that can help wether it takes 5 mins or not - PLEASE

 

Thanks all!

Link to comment
Share on other sites

if the cash is not tempting then I am prepared to offer my services (graphic artist) for free if needed - I HAVE to get this major problem sorted out - someone must know?? Please this is a very serious offer.

 

Thanks for your time everyone you have been great so far in getting me up and running with this great software - just so you know I am running MS1 and the latest versions of downloads controller and PayPalIPN for that version of OSCommerce.

Link to comment
Share on other sites

  • 2 years later...
if the cash is not tempting then I am prepared to offer my services (graphic artist) for free if needed - I HAVE to get this major problem sorted out - someone must know?? Please this is a very serious offer.

Thanks for your time everyone you have been great so far in getting me up and running with this great software - just so you know I am running MS1 and the latest versions of downloads controller and PayPalIPN for that version of OSCommerce.

 

Hi,

if anyone out there is still having this problem after many hours of lost sleep, the problem is in includes/modules/downloads.php

I re-installed this file from the default oscommerce so overwrote the download controllers downloads.php.It works the date is right but of course the button is not in the code, this can be done by taking out that code from the download controller version, for now Im off to bed :blink:

 

the code downloads.php

 

<?php

/*

$Id: downloads.php,v 1.3 2003/06/09 22:49:58 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

?>

<!-- downloads //-->

<?php

if (!strstr($PHP_SELF, FILENAME_ACCOUNT_HISTORY_INFO)) {

// Get last order id for checkout_success

$orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where customers_id = '" . (int)$customer_id . "' order by orders_id desc limit 1");

$orders = tep_db_fetch_array($orders_query);

$last_order = $orders['orders_id'];

} else {

$last_order = $HTTP_GET_VARS['order_id'];

}

 

// Now get all downloadable products in that order

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

if (tep_db_num_rows($downloads_query) > 0) {

?>

<TR>

<TD><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></TD>

</TR>

<TR>

<TD CLASS="main"><B><?php echo HEADING_DOWNLOAD; ?></B></TD>

</TR>

<TR>

<TD><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></TD>

</TR>

<TR>

<TD><TABLE BORDER="0" WIDTH="100%" CELLSPACING="1" CELLPADDING="2" CLASS="infoBox_form">

<!-- list of products -->

<?php

while ($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);

$download_expiry = date('Y-m-d H:i:s', $download_timestamp);

?>

<TR CLASS="infoBoxContents_form">

<!-- left box -->

<?php

// 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())) ) {

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";

}

?>

<!-- right box -->

<?php

echo ' <td class="main">' . TABLE_HEADING_DOWNLOAD_DATE . tep_date_long($download_expiry) . '</td>' . "\n" .

' <td class="main" align="right">' . $downloads['download_count'] . TABLE_HEADING_DOWNLOAD_COUNT . '</td>' . "\n" .

' </tr>' . "\n";

}

?>

</TR>

</TABLE></TD>

</TR>

<?php

if (!strstr($PHP_SELF, FILENAME_ACCOUNT_HISTORY_INFO)) {

?>

<TR>

<TD><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></TD>

</TR>

<TR>

<TD CLASS="smalltext" COLSPAN="4"><P><?php printf(FOOTER_DOWNLOAD, '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . HEADER_TITLE_MY_ACCOUNT . '</a>'); ?></P></TD>

</TR>

<?php

}

}

?>

<!-- downloads_eof //-->

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...