Forum

The forum is a free service supported by community members. Please consider opening a support ticket if you need timely help.

PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 27 Oct 2017 05:11 AM by  Robert Axford
Clickable file link in notification
 4 Replies
Sort:
You are not authorized to post a reply.
Author Messages


New Member


Posts:58
New Member


--
11 Oct 2017 02:53 AM

    Hi there

    We use the file upload custom field to allow customers to upload a photo with a product purchase. The order emails go directly to the print department to be fulfilled. The email notifications contain the image filename as text along with other custom field results. This is generated by the XSL repeater in the notification templates.

    {xsl:for-each select="dynamicFormResult/fields/field"}{xsl:value-of select="@id" /}: {xsl:value-of select="." /}, {/xsl:for-each}

    At the moment the print dept has to use the known path the portal folder in the module folder plus the filename from the email to construct a URL to retrieve the image.. i.e. they paste it altogether into a URL like: http://www.domain.com/Des...rtals/4/PostedFiles/92c3f4ba201-4d71-b53c-9c25635130cd.jpg

    In order to improve this process I'd like to construct the URL in the email so it can be clicked and the file retrieved directly.

    Is it possible to pull only the image filename out of the data and get that into the email so that I can create the clickable hyperlink in the email template?

    Regards
    Rob

    0


    Basic Member


    Posts:394
    Basic Member


    --
    13 Oct 2017 04:22 PM

    Yes, you should be able to construct it like this at the same location there. Please give it a try. Remember to replace 'your_field_id'.

    {xsl:value-of select="concat('http://www.domain.com/DesktopModules/Revindex.Dnn.RevindexStorefront/Portals/4/PostedFiles/', dynamicFormResult/fields/field[@id='your_field_id']/postedFile/storageFileName)" /}

    I hope this helps.

    0


    New Member


    Posts:58
    New Member


    --
    16 Oct 2017 05:03 AM

    Thanks heaps for this JT

    That works exactly as-is and produces the URL in the notification... perfect!

    Just one improvement I want to do is to make it a clickable link using an anchor tag.

    When I put an anchor around it, the template breaks and the email comes through as a pile of code.

    I've tried this, with double-quotes:

    <a href="{xsl:value-of select="concat('http://www.domain.com/DesktopModules/Revindex.Dnn.RevindexStorefront/Portals/4/PostedFiles/', dynamicFormResult/fields/field[@id='Photo']/postedFile/storageFileName)" /}">Download</a>

    and also the same again but with single-quotes. Every combination of quotes I try seems to break it.

    I've just done some googling on XSL hyperlinks and it looks like it's not as simple as putting it in an anchor. I've tried some of the suggestions but without success.

    If it's a drama don't worry, we 'll just use the URL, but if you already know how it works I'll be keen to hear.

    Thanks heaps
    ROb

    0


    Basic Member


    Posts:394
    Basic Member


    --
    19 Oct 2017 05:56 PM

    I think the HTML editor converts the double quote into " on save so it is breaking the XSL. In this case just use a variable to hold your URL like this so you can avoid the HTML escaping.

    {xsl:variable name="FileName" select="concat('http://www.domain.com/DesktopModules/...', dynamicFormResult/fields/field[@id='Photo']/postedFile/storageFileName)" /}
    <a href="{xsl:value-of select='$FileName' /}" >Download</a>

    0


    New Member


    Posts:58
    New Member


    --
    27 Oct 2017 05:11 AM

    Brilliant.. that works!

    This resolves that perfectly.

    Thanks for this!

    Rob

    0
    You are not authorized to post a reply.