Skip to content
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

Product List Sorting Options Not Working As Expected #883

Open
brandonmaynard opened this issue Apr 11, 2022 · 1 comment
Open

Product List Sorting Options Not Working As Expected #883

brandonmaynard opened this issue Apr 11, 2022 · 1 comment

Comments

@brandonmaynard
Copy link
Contributor

brandonmaynard commented Apr 11, 2022

Expected Behaviour

When adding both ACS & DESC sorting for the same key, the UI select should have each option with different values and only one 'selected' at a time.

Actual Behaviour

When adding both ACS & DESC for the same key, the UI has each option, but they have the same value and both are selected

Reproduce Scenario (including but not limited to)

Modify the ProductListImpl to add price with sorting options with ASC & DESC for the same key.
searchOptions.addSorterKey("price", "Price (low to high)", Sorter.Order.ASC);
searchOptions.addSorterKey("price", "Price (high to low)", Sorter.Order.DESC);

On the UI, the sorting dropdown has both Price (low to high) and Price (high to low) options, but they are both selected and they both have the same value (with sort_order=asc).

Steps to Reproduce

See above

Platform and Version

AEMaaCS - aem-sdk-quickstart-2022.2.6433.20220223T194056Z-220100.jar

Sample Code that illustrates the problem

On https://github.com/adobe/aem-core-cif-components/blob/master/bundles/core/src/main/java/com/adobe/cq/commerce/core/search/internal/services/SearchResultsServiceImpl.java I think we need to modify the condition and check for both key and order from the params:
if (sortKeyParam.equals(key.getName()) && sortOrder.equals(key.getOrder())) {
keyImpl.setSelected(true);
sorter.setCurrentKey(key);
keyOrder = sortOrder;
resultSorterKey = keyImpl;
} else if (keyOrder == null) {
keyOrder = sortOrder;
}

Logs taken while reproducing problem

N/A

@Buuhuu
Copy link
Contributor

Buuhuu commented Apr 28, 2022

Tracked in CIF-2736

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants