CartThrob 9 documentation for ExpressionEngine commerce teams Visit CartThrob.com
CartThrob.com

View Download Link

view_download_link is a legacy helper that builds an encrypted download URL path using a base template path plus encrypted segments.

This is an immediate-execution single tag.

For most modern implementations, prefer get_download_link or download_file_form.

See also:

Parameters

template

Base template path used as URL prefix.

The encrypted file/member parts are appended to this path.

template="{path=cart_software/download_file}"

file

Required file path to encrypt into the generated URL.

If missing, the tag returns download_url_not_specified error.

file="/var/www/html/themes/user/cartthrob/images/cartthrob_logo_bg.jpg"

member_id

Optional member restriction segment.

Supports dynamic values:

  • CURRENT_USER
  • {logged_in_member_id}
  • {member_id}

    member_id=”CURRENT_USER”

Behavior and Constraints

  1. Starts output with template value.
  2. Encrypts and appends file as URL segment.
  3. If member_id is provided, resolves dynamic placeholders and appends encrypted member segment.
  4. Returns the final URL string.

Notes:

  • This helper only supports file and optional member_id in this implementation.
  • It does not generate ACT query strings like get_download_link does.
  • Legacy helper retained for older templates/tutorials.

Examples

Legacy software-download tutorial style:

<a href="{exp:cartthrob:view_download_link
    template='{path=cart_software/download_file}'
    file='{path=themes/cp_themes/default/cartthrob/../images/cartthrob_logo_bg.jpg}'
    member_id='{logged_in_member_id}'}">Download</a>

Without member restriction:

<a href="{exp:cartthrob:view_download_link template='{path=downloads/file}' file='/var/www/files/product.zip'}">Download</a>