Jump to content

Edit History

redrum

redrum


Title updated with [SOLVED]

How can I get the real image path/folder location for the product images in a smarty .tpl-file?

Product images are stored with the following structure:
Product image id: 1234
Location: www.url.com/img/p/1/2/3/4/1234.jpg

'www.url.com/img/p/1/2/3/4/1234.jpg' is want I want to output in the .tpl-file.

I managed to get the folder structure and file name (ie: 1/2/3/4/1234.jpg) in smarty with the following code:

{$product.id_image|regex_replace:'/.*-/':''|spacify:'/'}/{$product.id_image|regex_replace:'/.*-/':''}.jpg

But I believe regex_replace is a bad practice to use in template files.

redrum

redrum

How can I get the real image path/folder location for the product images in a smarty .tpl-file?

Product images are stored with the following structure:
Product image id: 1234
Location: www.url.com/img/p/1/2/3/4/1234.jpg

'www.url.com/img/p/1/2/3/4/1234.jpg' is want I want to output in the .tpl-file.

I managed to get the folder structure and file name (ie: 1/2/3/4/1234.jpg) in smarty with the following code:

{$product.id_image|regex_replace:'/.*-/':''|spacify:'/'}/{$product.id_image|regex_replace:'/.*-/':''}.jpg

But I believe regex_replace is a bad practice to use in template files.

×
×
  • Create New...