Jump to content

[solved] Display a different default product image on products and categories pages


Recommended Posts

Hello,

Do anyone has any clue on how to display a different default product image on products and categories pages on Prestashop 1.7 ? 

For example :

- a product picture with grey background on category listing,

- and a red background on product page.

 

I found 2 old results in the forums, but these are not working anymore with 1.7:

https://www.prestashop.com/forums/topic/328948-16-different-image-for-cover-in-list-and-in-previewview/

https://www.prestashop.com/forums/topic/129341-resolu-miniature-produit-differente-de-la-photo-du-produit/

 

If anyone has ideas, thank you in advance for your help !

Edited by Juke29 (see edit history)
Link to comment
Share on other sites

I found a temporary solution, displaying 2nd product image on product page, and still use cover (selected default) product image on category listing.

 

Default img line in templates/catalog/_partials/product-cover-thumbnails.tpl I replaced :

<img class="js-qv-product-cover" src="{$product.cover.bySize.large_default.url}" alt="{$product.cover.legend}" title="{$product.cover.legend}" style="width:100%;" itemprop="image">
I wrote this instead of the default img line in templates/catalog/_partials/product-cover-thumbnails.tpl (replaced line above by this below) :

            {if isset($product.images[1])}
                <img class="js-qv-product-cover" src="{$product.images[1].bySize.large_default.url}" 
                     alt="{$product.cover.legend}" title="{$product.cover.legend}" style="width:100%;" itemprop="image">
            {else}
                <img class="js-qv-product-cover" src="{$product.cover.bySize.large_default.url}" 
                alt="{$product.cover.legend}" title="{$product.cover.legend}" style="width:100%;" itemprop="image">
            {/if}
Edited by Juke29 (see edit history)
  • Like 1
  • Thanks 2
Link to comment
Share on other sites

  • 1 year later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...