Fix broken WebP picture element in product grid listing#70
Open
Fix broken WebP picture element in product grid listing#70
Conversation
The <picture> element incorrectly declared type="image/webp" while getMasterZoomPictureUrl() returned a PNG/JPG master URL that bypasses PictureHandler and its WebP URL logic entirely. The fallback <img> was a transparent 1x1 GIF, rendering nothing on mobile viewports. Replace with a simple <img> using getPictureUrl(2) which correctly routes through PictureHandler::getProductPicUrl(), serving scaled images from /generated/ with proper .webp suffix when enabled.
getPictureUrl(2) always returns a URL (including nopic fallback), causing a cardboard box placeholder to appear on hover for products without a second image. Use getMasterZoomPictureUrl(2) for the condition check (returns false for nopic) while keeping getPictureUrl(2) for the src (WebP pipeline).
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
<picture>element inlistitem_grid.html.twigincorrectly declaredtype="image/webp"whilegetMasterZoomPictureUrl(2)returned a PNG/JPG master URL that bypassesPictureHandlerand its WebP URL logic entirely<img>was a transparent 1x1 GIF, rendering nothing on mobile viewports (< 1024px)Replaced with a simple
<img>usinggetPictureUrl(2)which correctly routes throughPictureHandler::getProductPicUrl(), serving scaled images from/generated/with proper.webpsuffix whenblConvertImagesToWebPis enabled. Desktop-only visibility is handled via Bootstrap'sd-none d-lg-blockinstead of the brokenmediaquery approach.Note: This is a backport-style fix for OXID 7.x. The same issue was addressed differently on
b-8.0.xvia OXDEV-9008 using the newMediaItemAPI.Test plan
type="image/webp", URL should point to/out/pictures/generated/(not/master/)blConvertImagesToWebPenabled: URL should end in.webp