简体   繁体   English

如何从prestashop 1.5.x中的附件产品获得链接?

[英]how get a link from attachment product in prestashop 1.5.x?

The attachment is a picture and I want to show on the product page.How do I get the src for this picture? 附件是图片,我想在产品页面上显示。如何获取此图片的src?

<a id="single_image" href="{$img_dir}tabel_marimi/tabel_marimi.jpg"><img style="width:25px;height:20px;" src="{$img_dir}tabel_marimi/table_mini.jpg" alt="" /></a>

src must be link to product attachment, not a general one for all products src必须链接到产品附件,而不是所有产品的通用附件

I know this is an old question, but in case someone runs into the same problem with Prestashop 1.6.x, this is how it's done: 我知道这是一个老问题,但是如果有人遇到Prestashop 1.6.x的相同问题,这是如何完成的:

{if $attachments}
    {foreach from=$attachments item=attachment}
        {$attachment.file_name} // This is the picture name
    {/foreach}
{/if}

Just point the src of the img tag to the route and append the $attachment.file_name at the end. 只需将img标签的src指向该路由,然后在末尾附加$attachment.file_name

You can see all the properties of the $attachment by making {print_r($attachment)} . 您可以通过制作{print_r($attachment)}来查看$attachment的所有属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM