Second product image on hover in PrestaShop 9: two ways
Swapping the image on hover is one of the cheapest listing upgrades: shoppers see the back of the product or the product being worn before they even click. PrestaShop 9 has no setting for it. Here are two ways to add it: by hand and ready-made.
Why it is worth it
In a category listing, shoppers judge a product by one photo. A second shot on hover (the back, a detail, the product in use) answers a question that would otherwise take a click to the product page. Fashion, furniture and home decor shops use it most, because that is where the second photo changes the most.
Option 1: by hand in the Classic theme
If you use the Classic theme (or one built on it), add the second image to the product miniature template and hide it under the first one.
Do it in a child theme, otherwise a theme update will overwrite your change. The miniature template is templates/catalog/_partials/miniatures/product.tpl. Below the cover image ($product.cover) add:
{if isset($product.images[1])}
<img class="hover-img"
src="{$product.images[1].bySize.home_default.url}"
alt="{$product.images[1].legend|default:$product.name}"
loading="lazy"
width="{$product.images[1].bySize.home_default.width}"
height="{$product.images[1].bySize.home_default.height}">
{/if}
And in the theme CSS:
.product-miniature .thumbnail-top { position: relative; }
.product-miniature .hover-img {
position: absolute; inset: 0; width: 100%; height: auto;
opacity: 0; transition: opacity .3s ease; pointer-events: none;
}
.product-miniature:hover .hover-img { opacity: 1; }
Then clear the cache (Advanced Parameters → Performance → Clear cache).
Watch out for
- Image order.
images[1]is the second image by position. If the cover is not the first image, the hover can show the same photo; skip the image markedcoverin Smarty. - Size. The code uses the
home_defaultsize. If your theme shows a different one, the two images will not match. - Hummingbird. PrestaShop 9's new theme has a different miniature structure, so the classes and the insertion point need adjusting.
- Phones. Touch screens have no hover, so the effect is desktop-only.
- Lazy-loading plugins that swap
srcfordata-srccan break the second image.
Option 2: a module, no template edits
If you would rather not maintain theme changes, or want more than a cross-fade, use a module. I built HoverFX for PrestaShop 9: it works on the existing product tiles in Classic and Hummingbird, without overriding theme files.
- 7 transitions: fade, slide, 3D flip, blur → sharp, grayscale → color, shine, or none.
- Tint, zoom and shadow set with sliders, with a live preview.
- Second image by position, or the one with the
hovercaption. - Keeps working after faceted filtering, sorting and pagination; no overrides, no database tables.
A license is 99 PLN excl. VAT (about €23), one-time, for one shop.
Which one to pick
The manual change is enough if you run Classic, want a plain cross-fade, and someone looks after the theme on updates. The module is the better choice with Hummingbird or a marketplace theme, when you want other effects, or when you would rather not touch templates. Not sure your theme fits? Ask: info@prestify.pl.
A question or a problem with your PrestaShop shop?
Get in touch