Skip to content

Commit f1aafd0

Browse files
committed
ACP2E-2266: set itemprop for main product image with or w/o fotorama loading
1 parent 8ea62ab commit f1aafd0

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

app/code/Magento/Catalog/view/frontend/templates/product/view/gallery.phtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ $mainImageData = $mainImage ?
3232
<img
3333
alt="main product photo"
3434
class="gallery-placeholder__image"
35+
itemprop="image"
3536
src="<?= /* @noEscape */ $mainImageData ?>"
3637
/>
3738
</div>

lib/web/mage/gallery/gallery.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,10 @@ define([
314314
$fotoramaElement.fotorama(config);
315315
$fotoramaElement.find('.fotorama__stage__frame.fotorama__active')
316316
.one('f:load', function () {
317+
// Mark itemprop on main image
318+
$fotoramaElement
319+
.find('.fotorama__stage__frame.fotorama__active img')
320+
.attr('itemprop', 'image');
317321
// Remove placeholder when main gallery image loads.
318322
$element.find('.gallery-placeholder__image').remove();
319323
$element

0 commit comments

Comments
 (0)