如何显示产品的第二张图片和最后一张图片?普雷斯塔商店



我想在悬停时显示某些产品的第二个产品图片。以及特定类别的最后一张图像。

我试图用这个来做到这一点,但我使用的是 v. 1.7.5.1

<a href="{$product.link|escape:'htmlall':'UTF-8'}" class="product_img_link" title="{$product.name|escape:'htmlall':'UTF-8'}">
    {assign var='productimg' value=Tools::getProductsImgs($product.id_product)}                         
    {if isset($productimg[0]) && isset($productimg[1])}
        <img class="img_0"  src="{$link->getImageLink($product.link_rewrite,$product.id_product|cat:"-"|cat:$productimg[0].id_image, 'home_default')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} />
        <img class="img_1" src="{$link->getImageLink($product.link_rewrite,$product.id_product|cat:"-"|cat:$productimg[1].id_image, 'home_default')}"alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} />                           
    {else}
        <img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html'}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} />                   
    {/if}
    {if isset($product.new) && $product.new == 1}<span class="new">{l s='New'}</span>{/if}
</a>

当我刷新页面时,我只看到标题"新集合",其中部分已打开且未关闭。没有别的,所有页面都是空的。

"Tools::getProductsImgs" 不存在。

试试这个:

{assign var='productimg' value=Image::getImages($language.id, $product.id)}                         
{if isset($productimg[0]) && isset($productimg[1])}
    <img class="img_0"  src="{$link->getImageLink($product.link_rewrite,$product.id_product|cat:"-"|cat:$productimg[0].id_image, 'home_default')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} />
    <img class="img_1" src="{$link->getImageLink($product.link_rewrite,$product.id_product|cat:"-"|cat:$productimg[1].id_image, 'home_default')}"alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} />
{else}
    <img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html'}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} />                   
{/if}

问候

最新更新