3

I keep getting a "Unable to locate file ID" when providing a file URL to the store:download tag. I believe this is because I am passing in the URL vs the actual server path.

If my assumptions are correct, how do I get the server path instead of the entire URL?

I've tried using all of the obvious available path variables within the file fieldtype pair and none of them seem to work.

4

If you're using the File Manager to upload then Store should properly create the download URL the file. Make sure the file is visible in the EE File Manager.

Per the Store docs:

The real URL to the file the user needs to download. You will usually retrieve this from a custom field in your products channel. The download tag will securely provide access to this file for paid orders. Note that internally this is looked up and traced back to a file ID. Therefore, if the file isn’t visible in the EE File Manager, the download tag won’t work.

| improve this answer | |
  • I am creating a file fieldtype on the product channel. Then uploading the file. – Nuno Albuquerque Nov 29 '12 at 23:51
  • OK, so after some head banging I found the problem. I am using the upload_preferences config override to handle multi server deployment... the download tag probably only looks at the db config for that path. I guess this might be considered a bug? – Nuno Albuquerque Nov 29 '12 at 23:58
  • Unable to locate file ID wouldn't be an issue with upload_preferences config override. Can you output your custom file field inside of the your template without the download tag already? – Justin Long Nov 30 '12 at 2:40
  • Yes the custom field outputs properly with and without the override. – Nuno Albuquerque Dec 4 '12 at 5:59
2

Something along the lines of:

{exp:store:orders member_id="CURRENT_USER"}
    <h1>Thank you for your Order:</h1>

    <h2>Ordered Items:</h2>
    <ul>
    {items}
    <li>
        <h3>{title} -- {price}</h3>
        {exp:channel:entries entry_id="{entry_id}"}
            {exp:store:download url="{download_custom_field}"}
                Download
            {/exp:store:download}
        {/exp:channel:entries}
    </li>
    {/items}
    </ul>
{/exp:store:orders}

Would create downloads links for all items purchased in all orders for the currently logged in user.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.