Download links in emails don't work v.2.0.14

Here’s a sample email, sent by my CS-Cart, for a test sale of a digital good that was paid through PayPal:



Neither download link works.



NOTE: I replaced my domain name with mysite.com. The rest of the URL is untouched.



The first URL (Sample Item) is:

http://www.mysite.com/index.php?dispatch=orders.downloads&product_id=1&ekey=486c861e2be17ce09ee3dd64f5708314
```<br />
The second URL (sampleItem.zip...) is:<br />
```php
http://www.mysite.com/index.php?dispatch=orders.get_file&file_id=1&product_id=1&ekey=486c861e2be17ce09ee3dd64f5708314
```<br />
 <br />
I get the following error when I try either link:<br />
![](upload://js0jfPaLAafH6rGFSWIP4Vs63Z9.jpeg)<br />
 <br />
 <br />
The download link on the website's order page works. Here it is:<br />
```php
https://www.mysite.com/index.php?dispatch=orders.get_file&ekey=486c861e2be17ce09ee3dd64f5708314&product_id=1&file_id=1
```<br />
Another thing I noticed is the webpage URL is https, not http. I guess this is done because I have [I]Enable secure connection for authentication, profile and orders pages...[/I] ticked in the admin panel. Downloading files via https is unnecessary and puts extra load on the server.<br />
 <br />
Presumably this is a bug in v.2.0.14 and I will report as such. [B]Anyone on here know how to fix?[/B]<br />
 <br />
I would also like to reformat the email template so I can add more info and delete one of those URL's.<br />
 <br />
I also noticed the download email is not sent to the purchaser if Google Checkout or PayPal Express is used.

Tried edits that were described here…

[URL]http://forum.cs-cart.com/showthread.php?t=10963[/URL]

…but they did not work.

Tested some more by changing the format of ‘edp_access.tpl’ so the email links that are created match the website links, almost.



Here’s my original ‘edp_access.tpl’:

```php



{assign var=“first_file” value=$edp_data[$oi.product_id].files|reset}

{$oi.product}


{foreach from=$edp_data[$oi.product_id].files item="file" key="file_id"}
{$file.file_name} ({$file.file_size|number_format:0:'':' '} {$lang.bytes})


{/foreach}
---
```

Here's my changes:
```php
---
{assign var="first_file" value=$edp_data[$oi.product_id].files|reset}
{$oi.product} -
{foreach from=$edp_data[$oi.product_id].files item="file" key="file_id"}
{$file.file_name} ({$file.file_size|number_format:0:'':' '} {$lang.bytes})


{/foreach}
---
```

I have [I]Enable secure connection for authentication, profile and orders pages... [/I]enabled. Because of this, it seems CS-Cart creates https links for the webpage. The links that are created for the emails are http.

If I just click on either link in the email, it opens IE8 and I get the error. If I manually open IE8, login to CS-Cart as the buyer, copy the URL from the [B]FIRST LINK (download page)[/B] in the email, paste it into the browser's address bar and add a "s" to "http", it works. If I follow the same steps except for logging in, it does not work. In order for the [B]FIRST LINK (download page)[/B] to work, the user has to be logged in. If the user is not, then he is directed to the home page. Shouldn't he be directed to the login page instead?

This is a real problem for users that use multiple browsers. Say for instance a buyer uses FF to browse the Internet and to make a purchase on my site but IE is his default browser. That means he logged in with FF but when he clicks on the [B]FIRST LINK (download page)[/B] in the email, IE will open and the user will be taken to the home page since he did not log in with IE.

I not that concerned about the [B]FIRST LINK (download page). [/B]The[B] SECOND LINK (file download)[/B] is the one that I want to use in my template.

As for the [B]SECOND LINK (file download)[/B], it does not work in IE8 at all. I get the same error if I click on the link in the email or if I copy and paste to a browser window. The same exact link does work in FF, Opera and Safari. I tested on three different computers and got the same results each time.

The emailed links DO require the customer to log in. That is part of the security - only logged in users can download their files.



I have not upgraded to 2.0.14 yet and have not had any issues with customers complaining about emailed links. I also have my account area set to https:// which unfortunately means that the downloads ARE https:// as well. So the bug with 2.0.14 seems to be that the emailed links are linking customers to http:// instead of https://



As for the issue about downloading files via https, it’s either that or not have the account area set to https. I would like to turn it off for the download links because there is a bug with some version(s) of IE that gives the customer the error ‘file cannot be written to cache’. There is a “Do not save encrypted pages to disk” setting in that version of IE that is the culprit.



If I were you and looking for a fix while cs-cart is looking into it, I would just hard-code the https into the email template. I’m guessing that {$config.http_location} is the part of the link that sets that?



Submit a bug report in the bug tracker:

[url]CS-Cart Community Forums

[quote name=‘ogia’]…only logged in users can download their files[/quote]

This is true for the FIRST LINK (download page). The problem is that the user gets the home page instead of a login screen if the user is not already logged in. That means the email links are going to fail for buyers that use multiple browsers.

Hm, I guess I don’t see what the big deal is about the email links. To me it is old technology - my old cart relied totally on email and it was very inefficient since many email providers blocked the links and there were other issues with the links getting corrupted or were not clickable (yeah… customers were too ignorant to cut/paste).



I switched to cs-cart last September and have sold thousands of files since then with no issues. I haven’t had a single customer have problems accessing their My Account area to download. The email links don’t fail - they just direct the customer to log in if they aren’t.



I wouldn’t have a problem disabling the email all together. In fact, I have considered that since the My Account area has all the steps for downloading and has troubleshooting information right there. It helps cut down on support requests.

[quote name=‘ogia’]…don’t see what the big deal is about the email links.[/quote]

You must have a more sophisticated clientele than I. Even though my emails contain concise instructions, some of my customers find it easier to email me about broken links than to just login to the site and download from there.


[quote name=‘ogia’]The email links don’t fail - they just direct the customer to log in if they aren’t.[/quote] Mine don’t do that. What version of what browser have you tested to get those results?



After further testing I have figured out exactly what’s happening.



The FIRST LINK (download page) is supposed to take the user to the Downloads page of their account when clicked. IE8 is my default browser. It’s the browser that opens when a link is clicked in an email. If I used FF to pay for the test item, I’m logged in with FF, not IE8. Therefore, the link just takes me to the home page when clicked. At least this link works in IE8 but I’m not all that concerned about link one.



The SECOND LINK (download file) is supposed to start the download of the file when clicked. This link does not work when clicked or when cut and pasted into IE8. However, I can paste it in FF, Opera and Safari and it works and does not require the user to be logged in.



So the bottom line is https links need to be generated when using SSL for account access and the SECOND LINK (download file) does not work in IE8 at all. Unfortunately, IE8 is the default browser for the largest percentage of users.



I have two other websites that use PHP scripting to hide the location of downloadable files and those script-generated links work in IE8. So IE8 does not like something about the URL’s CS cart generates.

Okay - I double checked what the links in my emails do… I was wrong about being asked to log in. The first link (the one linking to the title of the product) directs users to their My Account area. If they aren’t logged in, it goes to the home page like it does for you. The second link (that links to the filename) will allow users to download without logging in. My links go to FF when I click on them in an email.



It’s possible there is a bug with IE8 or something. I can’t verify right now because I uninstalled IE8 since it was giving me problems. I can confirm, however, that pasting the link into IE7 works just fine. I’m using 2.0.12.



By the way, my customers are far from sophisticated which is why I prefer that they don’t even use the email. They have an easier time downloading from their My Account area and I have fewer support requests to tend to. That’s why I love cs-cart so much vs. my old cart.

Ogia, thanks for all the info;)