function, since version 1.0.0
categories: image, product, prestashop

productImage(imageId, name, [type])

returns url to product image. Function respects prestashop Friendly URL settings.


return type:



productImage(product.imageId, product.friendlyUrl)
productImage(product.imageId, 'product-''-'+product.friendlyUrl)
productImage(product.imageId, 'img', 3)

if Friendly URL are enabled

if Friendly URL are disabled:

advanced example

Image file names can help us with our SEO efforts. By default, image file names are based on friendlyURL field of associated product, so all images of the same product will have the same suffix. Although images in PrestaShop don’t have their own friendlyURL field, they have caption / label field.

We would like to use this legend field as image filename. It can contain any characters so we need to sanitize its value – we allow only alphanumeric characters, anything else will be replaced by dash. This field can also be empty – in that case, we want to fallback to friendlyUrl field.


Related functions:

Update your privacy settings