Page 1 of 2
[MOD] - Download Links in Emails
Posted: Fri Feb 19, 2010 5:16 am
by Qphoria
This is a mod to add direct file links to downloads as part of the order email.
It is only for 1.4.0 or later, as that is when the order email was moved to a template.
1. EDIT: catalog/view/theme/YOURTHEME/template/mail/order_confirm.tpl
2. FIND THE LAST INSTANCE OF:
3. BEFORE, ADD:
Code: Select all
<!--//Q: BOF Add download links to email -->
<?php
global $db, $language, $loader;
$url = new Url();
Registry::set('url', $url);
$loader->language('account/download');
$query = $db->query("SELECT order_download_id, name FROM " . DB_PREFIX . "order_download WHERE order_id = '" . $order_id . "'");
?>
<?php if ($query->num_rows) { ?>
<tr>
<td align="left" style="background-color: #069; color: #FFF; font-size: 12px; font-weight: bold; padding: 0.5em 1em;"><?php echo $language->get('text_downloads'); ?></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td align="left">
<?php foreach ($query->rows as $download) { ?>
- <a href="<?php echo $url->http('account/download/download&order_download_id=') . $download['order_download_id']; ?>"><?php echo $download['name']; ?></a><br/>
<?php } ?>
</td>
</tr>
<tr>
<td> </td>
</tr>
<?php } ?>
<!--//Q: EOF Add download links to email -->
Re: [MOD] - Download Links in Emails
Posted: Thu Feb 25, 2010 12:36 pm
by caspara
Didn't seem to work for me with OpenCart 1.4. Added the code, uploaded and upon receiving the order confirmation, the normal customer email notification remained the same (no direct download link). Did I do something wrong?
Re: [MOD] - Download Links in Emails
Posted: Thu Feb 25, 2010 1:36 pm
by Qphoria
nope.. that should be it. I'll try it on another of my test installs
Re: [MOD] - Download Links in Emails
Posted: Fri Feb 26, 2010 8:15 am
by caspara
[EDIT]
Umm, I was wrong.
The mod works fine as is. Sorry.
Chris
Re: [MOD] - Download Links in Emails
Posted: Fri Feb 26, 2010 9:20 am
by Qphoria
That really isn't right.. but I'll let you run with it .
Re: [MOD] - Download Links in Emails
Posted: Mon Apr 05, 2010 10:16 pm
by allenshea
how to make this working for 1.4.6?
If I add these code, the host didn't send me any new order, but once I deleted them, I can always got new orders.
How can I fix it?
Thanks.
Allen
Re: [MOD] - Download Links in Emails
Posted: Fri Apr 30, 2010 6:46 am
by cwmahan
Has anyone gotten this mod to work in 1.4.7?
I've added it as specified above, but it seems to break the email in general. At least, when its added, no order confirmation email is sent at all.
Would love to know if its just me or not.
thanks for the mod in the first place, and if I get it working b4 anyone else I'll try to post the fix here...
Re: [MOD] - Download Links in Emails
Posted: Fri Apr 30, 2010 9:33 am
by Qphoria
if it breaks completely then there is likely an error being logged in the error log. What does it show ? (system->error log)
Re: [MOD] - Download Links in Emails
Posted: Fri May 07, 2010 6:19 pm
by dramony
how about for 1.3.2?
Thanks!
Re: [MOD] - Download Links in Emails
Posted: Tue May 25, 2010 12:07 am
by huxleydata
cwmahan wrote:Has anyone gotten this mod to work in 1.4.7?
I've added it as specified above, but it seems to break the email in general. At least, when its added, no order confirmation email is sent at all.
Would love to know if its just me or not.
thanks for the mod in the first place, and if I get it working b4 anyone else I'll try to post the fix here...
I get exactly the same problem when I add the mod. No error message in the error logs. If I remove the code the confirmation is sent out again. My PHP skills are limited, but I'm pretty sure I've followed the instructions OK.
Would be really good to get this to work

Re: [MOD] - Download Links in Emails
Posted: Fri May 28, 2010 8:10 am
by mancourt
Bumping this one... Anyone get it to work yet in 1.4.7?
Re: [MOD] - Download Links in Emails
Posted: Tue Dec 07, 2010 8:49 pm
by chillala
Bumping, hoping to see this can work in the latest 1.4.9.2. Anyone?
Re: [MOD] - Download Links in Emails
Posted: Fri Jan 14, 2011 2:05 am
by neosdesign
Has anyone got this confirmed working on 1.4.9.1? I would very much like to use it. Thanks!
Re: [MOD] - Download Links in Emails
Posted: Sat May 28, 2011 12:16 pm
by wintech
For anyone who might be interested in this, I was having the same problem where after inserting this code I would no longer get an order confirmation email sent to the customer.
I have been able to get this working successfully in OC 1.4.9.5 using the modified code below.
The problem I was having was with the url variable so I have just changed the code to use the
$store_url variable already assigned in order_confirm.tpl.
Regards.
Code: Select all
<!--//Q: BOF Add download links to email -->
<?php
global $db, $language, $loader;
$loader->language('account/download');
$query = $db->query("SELECT order_download_id, name FROM " . DB_PREFIX . "order_download WHERE order_id = '" . $order_id . "'");
?>
<?php if ($query->num_rows) { ?>
<tr>
<td align="left" style="background-color: #069; color: #FFF; font-size: 12px; font-weight: bold; padding: 0.5em 1em;"><?php echo $language->get('text_downloads'); ?></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td align="left">
<?php foreach ($query->rows as $download) { ?>
<a href="<?php echo $store_url; ?>index.php?route=account/download/download&order_download_id=<?php echo $download['order_download_id']; ?>"><?php echo $download['name']; ?></a><br/>
<?php } ?>
</td>
</tr>
<tr>
<td> </td>
</tr>
<?php } ?>
<!--//Q: EOF Add download links to email -->
Re: [MOD] - Download Links in Emails
Posted: Wed Jun 08, 2011 3:45 am
by kgerken
WORKS GREAT! THANK YOU!

Re: [MOD] - Download Links in Emails
Posted: Wed Jul 06, 2011 6:36 pm
by mattbrooker
wintech works great now thanks
Re: [MOD] - Download Links in Emails
Posted: Wed Jul 06, 2011 10:44 pm
by Maansy
Waiting for v1.5
Re: [MOD] - Download Links in Emails
Posted: Sat Jul 16, 2011 8:18 am
by FT Industriels
THANK YOU! WORKS GREAT!
Re: [MOD] - Download Links in Emails
Posted: Thu Mar 22, 2012 9:38 am
by eleven28
Thanks wintech! Works for me in 1.5.1.3.
Re: [MOD] - Download Links in Emails
Posted: Mon Jan 28, 2013 6:37 pm
by budalal
Hi
Works nicely thanks. Will this show up only if there is a download?
Thanks