kamppa Posted February 11 Share Posted February 11 How can I show second image on categories page as thumbnails? product-thumb-tpl has this: <img {if $product.default_image} data-full-size-image-url="{$product.default_image.large.url}" {generateImagesSources image=$product.default_image size='home_default' lazyload=true} alt="{if !empty($product.default_image.legend)}{$product.default_image.legend}{else}{$product.name|truncate:30:'...'}{/if}" width="{$product.default_image.bySize.home_default.width}" height="{$product.default_image.bySize.home_default.height}" {else} src="{$urls.no_picture_image.bySize.home_default.url}" alt="{$product.name|truncate:30:'...'}" width="{$urls.no_picture_image.bySize.home_default.width}" height="{$urls.no_picture_image.bySize.home_default.height}" {/if} class="img-fluid rounded lazyload" /> But I don't know what should be instead of $product.default_image to show the second image? Link to comment Share on other sites More sharing options...
kamppa Posted February 15 Author Share Posted February 15 Prestashop 8.1.2 Link to comment Share on other sites More sharing options...
Mr Rick Posted February 27 Share Posted February 27 Hello, You can simply use images, it has all the collection. $product.images Link to comment Share on other sites More sharing options...
kamppa Posted February 27 Author Share Posted February 27 (edited) What I mean is that how can this image that is shown for product not be the default cover image but second image?https://ibb.co/gms6JDV Edited February 27 by kamppa (see edit history) Link to comment Share on other sites More sharing options...
Mr Rick Posted February 27 Share Posted February 27 You can grab the second image from the array of $product.images. Link to comment Share on other sites More sharing options...
kamppa Posted February 27 Author Share Posted February 27 I am sorry but I am total noob when it comes to arrays etc. I am fine with editing .tpl files but I don't know what to change to show the other image. Link to comment Share on other sites More sharing options...
Mr Rick Posted February 28 Share Posted February 28 If you do the dump on top of the file, you can see it as an array {dump($product.images)} For example this code may work for you {if isset($product.images[1])} <img src="{$product.images[1].bySize.home_default.url}" /> {/if} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now