URL Filters

product_img_url(size="100x100")

Generates a full URL for a product image.

size can be any of:
50x50, 100x100, 150x150, 300x300, 600x600

size defaults to 100x100.

{{ product.image|product_img_url("50x50") }}

Would generate a URL similar to:

http://static.dpdcart.com/p/1234/50x50/image.png

Note

The product_img_url filter always returns an image. If the product doesn’t have an image uploaded, it will return a URL for a blank gif.

add_to_cart_url

Generates the URL to add a product to the cart.

<a href="{{ product|add_to_cart_url }}" class="button">Add to Cart</a>

Note

This filter is only usable on the cart page.

remove_from_cart_url

Generates the URL to remove a product to the cart.

<a href="{{ item|remove_from_cart_url }}" class="button">Remove From Cart</a>

Note

This filter is only usable on the cart page.

file_download_url

Generates the URL to download a file.

<a href="{{ item.files[0]|file_download_url }}">Download</a>

Note

This filter is only usable on the delivery page.

keycode_download_url

Generates the URL to download a keycode.

{% for key in item.keycodes %}
  <a href="{{ key|keycode_download_url }}">Download Key</a>
{% endfor %}

Warning

The snippet.keycode_html snippet is highly recommended over using this filter directly.

Note

This filter is only usable on the delivery page.

product_url

Generates the URL to view a product’s detail page.

<a href="{{ product|product_url }}">Learn more</a>