Skip to content

Commit

Permalink
fix: remove sortkey 'default' from product list REST calls to prevent…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
SGrueber authored Dec 12, 2023
1 parent c500625 commit cf7541c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/app/core/services/products/products.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit cf7541c

Please sign in to comment.