As the title suggest and as screeshot show, how can I get only the downloadable product URL of every product ordered and show it in email template?
I want to highlight the link(s) in the email sent.
ce-1.9.1.0downloadableemail-templates
As the title suggest and as screeshot show, how can I get only the downloadable product URL of every product ordered and show it in email template?
I want to highlight the link(s) in the email sent.
Best Answer
One way to do it would be to create a block in a custom module that fetches download links from the database for current order. It is similar to how download links are currently generated for each order item. Block can be added to order emails using custom layout update handle, same way order items are added.
Module structure is pretty simple, we only need two files. First one is our module configuration in
app/code/local/Custom/Module/etc/config.xml
And our block:
app/code/local/Custom/Module/Block/Email/Download/Links.php
Obviously we will also need a template file for our block and a layout update file to add our handle.
Template location is arbitrary, I saved it in
app/design/frontend/your_package/your_theme/template/custommodule/email/download/links.phtml
and it looks like this:I didn't want to register new layout file so I opted for
local.xml
instead. File is saved inapp/design/frontend/your_package/your_theme/layout/local.xml
Now we just have to insert this in our email template and we are done. I did it from admin
(System > Transactional Emails)
since I already had order email configured there. You just have to find a suitable location, depending on your markup, and insert this piece of code:{{layout handle="email_download_links" order=$order}}
Of course you can always change markup in
links.phtml
to fit your specific needs.And that's all there is to it. Hope this makes sense :)