From cf7541c3b07e7aef25184cff991b9c7444eafbaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Silke=20Gr=C3=BCber?= Date: Tue, 12 Dec 2023 19:44:00 +0100 Subject: [PATCH] fix: remove sortkey 'default' from product list REST calls to prevent inconsistent results (#1550) The "sortKey" and "sorting" parameter is set to "default" when the "Default Sorting" option is selected via dropdown. This leads to incorrect sorting of the products, as this "default" parameter is not an existing sorting key. --- src/app/core/services/products/products.service.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/core/services/products/products.service.ts b/src/app/core/services/products/products.service.ts index 129f7f5733..fa9f9bf708 100644 --- a/src/app/core/services/products/products.service.ts +++ b/src/app/core/services/products/products.service.ts @@ -76,7 +76,7 @@ export class ProductsService { .set('offset', offset.toString()) .set('returnSortKeys', 'true') .set('productFilter', 'fallback_searchquerydefinition'); - if (sortKey) { + if (sortKey && sortKey !== 'default') { params = params.set('sortKey', sortKey); } @@ -129,7 +129,7 @@ export class ProductsService { .set('attrs', STUB_ATTRS) .set('attributeGroup', AttributeGroupTypes.ProductLabelAttributes) .set('returnSortKeys', 'true'); - if (sortKey) { + if (sortKey && sortKey !== 'default') { params = params.set('sortKey', sortKey); } @@ -174,7 +174,7 @@ export class ProductsService { .set('attrs', STUB_ATTRS) .set('attributeGroup', AttributeGroupTypes.ProductLabelAttributes) .set('returnSortKeys', 'true'); - if (sortKey) { + if (sortKey && sortKey !== 'default') { params = params.set('sortKey', sortKey); } @@ -205,7 +205,7 @@ export class ProductsService { .set('attrs', STUB_ATTRS) .set('attributeGroup', AttributeGroupTypes.ProductLabelAttributes) .set('returnSortKeys', 'true'); - if (sortKey) { + if (sortKey && sortKey !== 'default') { params = params.set('sortKey', sortKey); } params = appendFormParamsToHttpParams(omit(searchParameter, 'category'), params);