Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 06-26-2009 13:03:21

mickyharris
Member
Registered: 03-30-2009
Posts: 16

Digital Download Timeout Problem

Hi,

I am trying to implement digital downloads on heliumrecords.co.uk. There are three issues I've got - if anybody has come across this before I would be really grateful for any help.

I've created the product, uploaded the file (via FTP) to the /khxc-private/downloads/ folder and associated the file with the product.
I've also password protected the /public/downloads/ folder with .htaccess - so far so good.

However...

1. When a customer places an order (via PayPal) FOUR copies of the file are created in the public/downloads folder.
2. ONE order is created in the database and admin back-end, however, the customer is getting TWO order emails with different filenames in each for download.
3. Then when the user clicks either download link and enters the username and password, the file starts to download but always quits out at around 10MB (it's a 40MB zip file).

The copied zip files are fine and they download perfectly via FTP or if accessed directly as in the URL below:
http://www.heliumrecords.co.uk/shop/dow … tering.zip

It seems to be a timeout issue when the http request is routed via the download script as in:
http://www.heliumrecords.co.uk/shop/dow … tering.zip

The shop is working fine for regular shipped orders, I just can't work out what I'm doing wrong in terms of the duplicate emails, duplicate files or the timeout on the download script.

Any help appreciated, thank you.

Micky H.

Offline

 

#2 06-28-2009 09:35:28

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Digital Download Timeout Problem

mickyharris wrote:

1. When a customer places an order (via PayPal) FOUR copies of the file are created in the public/downloads folder.

Did you by any chance duplicate any of the files in the {private}/apps/ccp0/CCP_Order/ext directory?  As delivered there's only one place where download files get created but if there were more than one copy of 0920_mailcustomer.php in that directory more than 1 file would end up being created.

mickyharris wrote:

2. ONE order is created in the database and admin back-end, however, the customer is getting TWO order emails with different filenames in each for download.

Sounds related to number 1 above.

mickyharris wrote:

3. Then when the user clicks either download link and enters the username and password, the file starts to download but always quits out at around 10MB (it's a 40MB zip file).

It seems to be a timeout issue when the http request is routed via the download script as in:
http://www.heliumrecords.co.uk/shop/dow … hattering.

There should be no difference between direct or using the downloads program.  The end result is the same.  downloads.php is very simple and doesn't do more than verify the file to be downloaded exists then delivers it.

Offline

 

#3 06-30-2009 04:39:25

mickyharris
Member
Registered: 03-30-2009
Posts: 16

Re: Digital Download Timeout Problem

Thanks for this Dave, I've been doing some further investigation.

In response to 1 and 2 there are no duplications of files in those folders on the server. However, after further testing the scripts are creating TWO copies of the file with different filenames - one which appears in the email to the customer with the other file created and referenced in the email to the shopkeeper. This would indicate the problem is connected to the script that sends the emails. I've done no mods to any of these files, but I'm not too concerned, its a minor issue, but if you can throw any light on this I'd be grateful.

I'm still getting the download timeout issue outlined in 3 which I think is connected to an output buffer issue with the host. Interestingly (annoyingly) the same problem is happening with another force download script I am using in a different area of the site. Again, all is fine if the http request is referencing the files directly rather than through the force download scripts.

Therefore, can you direct me to the script that echo's the URL to the download in the customer email please, I may need to modify this to give the direct URL to the file, they will all be zip files so will force the browser to save the file in any case.

Another issue has come to light with the cronjob that cleans up the copied files in the public/download/ directory - it is deleting my .htgroup file and htaccess admin scripts - I've created a new topic for this here https://forum.kryptronic.com/viewtopic.php?id=24721.

Thanks for your help.

M

Last edited by mickyharris (06-30-2009 04:49:08)

Offline

 

#4 06-30-2009 05:34:47

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Digital Download Timeout Problem

Look at the 0100_rmpubdls.php file which you'll find in the [private]/core/KHXC/tasks_daily directory.  Early on you'll see an array of files that shouldn't be touched.  Simply add that file to the array.

The only reference to the download processing code anywhere in the code base is in the mailcustomer code which is called after an order is processed and completed.  Search the entire CCP private directory for $this->process_downloads and you should get one hit.

Offline

 

#5 07-03-2009 09:07:02

mickyharris
Member
Registered: 03-30-2009
Posts: 16

Re: Digital Download Timeout Problem

Dave wrote:

The only reference to the download processing code anywhere in the code base is in the mailcustomer code which is called after an order is processed and completed.  Search the entire CCP private directory for $this->process_downloads and you should get one hit.

Hi, I'm getting two hits for $order = $this->process_downloads($order);

One in 0900_mailinternal.php and one in 0920_mailcustomer.php which would explain the duplication of files as it is being executed twice.

I will also need to amend the process_downloads() function (in GBU_Order.php) to write the URL directly to the file rather than through the downloads script as the host cannot resolve the timeout issue I am getting when running downloads.php.

Could you confirm the variable I will need to edit is on line 2026 -
$downloads[$file] = $this->globals('khxc.url_nonssl') . '/downloads/downloads.php?file=' . urlencode($randfile);

Thanks very much for all your help with this.

M

Offline

 

#6 07-03-2009 09:13:24

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Digital Download Timeout Problem

mickyharris wrote:

Hi, I'm getting two hits for $order = $this->process_downloads($order);

One in 0900_mailinternal.php and one in 0920_mailcustomer.php which would explain the duplication of files as it is being executed twice.

If line 130 in 0900-mailinternal.php reads

Code:

$order = $this->process_downloads($order);

change it to read:

Code:

#$order = $this->process_downloads($order);

so it doesn't get executed.  It certainly should not be in there (I'm surprised nobody has run into this before).

mickyharris wrote:

Could you confirm the variable I will need to edit is on line 2026 -
$downloads[$file] = $this->globals('khxc.url_nonssl') . '/downloads/downloads.php?file=' . urlencode($randfile);

That would be the correct place.

Offline

 

#7 07-03-2009 09:33:54

mickyharris
Member
Registered: 03-30-2009
Posts: 16

Re: Digital Download Timeout Problem

Thanks Dave,

I've amended GBU_Order.php to write the URL directly to the file and this is working fine now. Of course, this will have the downside of disabling direct downloads of individual files that the browser can display (mp3's, movies, images etc).

I may write a mod to check the filesize of $randfile and write the URL directly to the file if it's over say 8MB, this should then catch most individual media files we may want to sell as a download. Either that or ensure we zip up all files for download.

I've also commented out the process_downloads() function call on line 130 of 0900_mailinternal.php as you suggest.

Thanks again

M

Offline

 

#8 09-14-2009 21:27:54

Shopper
Member
Registered: 09-10-2007
Posts: 94

Re: Digital Download Timeout Problem

I've also commented out line 130. After that I did not receive the internal confirmation mail anymore! Better to keep the duplicate file in the downloads folder.

Offline

 

#9 11-19-2010 12:18:58

nicknice99
Member
Registered: 05-21-2008
Posts: 3

Re: Digital Download Timeout Problem

I experienced the same problem with a digital download timing out when a user tries to download the file they purchased. I resolved this by editing the GBU_Order.php to access the downloads file/folder directly rather than going through the download.php script. This resolved the issue for me fine.

Offline

 

Board footer