-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Improve performance of the Category page #40082
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.4-develop
Are you sure you want to change the base?
Conversation
Lazy load all images except 1. Lazy load negatively impacts LCP metric you shouldn't lazy load LCP element for category it is first image if no big image in the description. We are adding global counter
Hi @Genaker. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -11,6 +11,12 @@ | |||
$width = (int)$block->getWidth(); | |||
$height = (int)$block->getHeight(); | |||
$paddingBottom = $block->getRatio() * 100; | |||
|
|||
if (!isset($_GET['cat_image'])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 Direct call to global variables is unacceptable. Please use RequestInterface
to access request params.
@magento create issue |
@@ -11,6 +11,12 @@ | |||
$width = (int)$block->getWidth(); | |||
$height = (int)$block->getHeight(); | |||
$paddingBottom = $block->getRatio() * 100; | |||
|
|||
if (!isset($_GET['cat_image'])) { | |||
$_GET['cat_image'] = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 Modifying global variables such as $_GET or $_POST, including operations that indirectly change their values (e.g., incrementation), is considered unacceptable.
You can make it different. It is just direction what you need to achieve to
improve performance.
You can make it using $this->getRequest()
$request = $block->getRequest();
$catImage = $request->getParam('cat_image_counter');
if (!$catImage) {
$catImage = 0;
$request->setParam('cat_image_counter', $catImage);
}
$catImage++;
$request->setParam('cat_image_counter', $catImage);
…On Wed, Jul 23, 2025 at 2:30 AM Bernard van der Esch < ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In
app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml
<#40082 (comment)>:
> @@ -11,6 +11,12 @@
$width = (int)$block->getWidth();
$height = (int)$block->getHeight();
$paddingBottom = $block->getRatio() * 100;
+
+if (!isset($_GET['cat_image'])) {
+ $_GET['cat_image'] = 0;
🔴 Modifying global variables such as $_GET or $_POST, including
operations that indirectly change their values (e.g., incrementation), is
considered unacceptable.
—
Reply to this email directly, view it on GitHub
<#40082 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACGJNZVG36U7JJNKQC2OEVT3J5I2RAVCNFSM6AAAAACB63234CVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTANBWGUYDINZQGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Lazy load all images except 1. Lazy load negatively impacts LCP metric you shouldn't lazy load LCP element for category it is first image if no big image in the description. We are adding global counter
Resolved issues: