From 960c668e31ea6c8e24715aac9b349618f26cc9a2 Mon Sep 17 00:00:00 2001 From: Lukasz Bajsarowicz Date: Fri, 18 Jul 2025 11:35:16 +0200 Subject: [PATCH] SwiftOtter-SOP-348 Resolve issues with Product listing with negative Page # --- app/code/Magento/Catalog/Controller/Category/View.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/code/Magento/Catalog/Controller/Category/View.php b/app/code/Magento/Catalog/Controller/Category/View.php index da7c5326587e3..66f7b8801835e 100644 --- a/app/code/Magento/Catalog/Controller/Category/View.php +++ b/app/code/Magento/Catalog/Controller/Category/View.php @@ -212,6 +212,13 @@ public function execute() $category = $this->_initCategory(); if ($category) { + // Negative ?p= value is not supported, redirect to a base version of category page. + if ($this->_request->getParam(Toolbar::PAGE_PARM_NAME) < 0) { + return $this->resultRedirectFactory->create() + ->setHttpResponseCode(301) + ->setUrl($category->getUrl()); + } + $this->layerResolver->create(Resolver::CATALOG_LAYER_CATEGORY); $settings = $this->_catalogDesign->getDesignSettings($category);