如何展示产品的第二张图片和最后一张? PrestaShop
How to show the second image of the product and the last one? PrestaShop
我想在悬停某些产品时显示第二张产品图片。
以及特定类别的最后一张图片。
我试着用这个来做,但我使用的是 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>
当我刷新页面时,我只看到标题 "New collection" 并且该部分已打开但未关闭。没有别的,所有页面都是空的。
"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}
此致
我想在悬停某些产品时显示第二张产品图片。 以及特定类别的最后一张图片。
我试着用这个来做,但我使用的是 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>
当我刷新页面时,我只看到标题 "New collection" 并且该部分已打开但未关闭。没有别的,所有页面都是空的。
"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}
此致