From 6949ece7ed50a3454ed63efa305c5ff921d250fa Mon Sep 17 00:00:00 2001 From: Silke Date: Mon, 11 Dec 2023 09:58:18 +0100 Subject: [PATCH] fix: remove sortkey 'default' from product list REST calls to prevent inconsistent results 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);