Skip to content

Issue 31043: Elastic Search interferes with the default sort order of products (changing newest first to oldest first) #36900

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

Open
wants to merge 8 commits into
base: 2.4-develop
Choose a base branch
from

Conversation

rogerdz
Copy link
Contributor

@rogerdz rogerdz commented Feb 21, 2023

Description (*)

Add sorting condition by product id desc

Additional Information

  • To maintain backward compatibility, We are going to introduced a store configuration for the Sort Order.
  • Path for config : Stores-> Configuration -> Catalog-> Catalog-> Storefront -> Product Listing Sort by Order

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes Elastic Search interferes with the default sort order of products (changing newest first to oldest first) #31043

Manual testing scenarios (*)

  1. ...
  2. ...

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Feb 21, 2023

Hi @rogerdz. Thank you for your contribution!
Here are some useful tips on how you can test your changes using Magento test environment.

Add the comment under your pull request to deploy test or vanilla Magento instance:
  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names.

Allowed build names are:
  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here
ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation.
Join Magento Community Engineering Slack and ask your questions in #github channel.

@m2-community-project m2-community-project bot added Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: pending review labels Feb 21, 2023
@rogerdz
Copy link
Contributor Author

rogerdz commented Feb 21, 2023

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@rogerdz
Copy link
Contributor Author

rogerdz commented Feb 22, 2023

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@rogerdz
Copy link
Contributor Author

rogerdz commented Feb 22, 2023

@magento give me test instance

@magento-deployment-service
Copy link

Hi @rogerdz. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@rogerdz
Copy link
Contributor Author

rogerdz commented Feb 22, 2023

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@TuVanDev
Copy link
Member

@magento give me test instance

@magento-deployment-service
Copy link

Hi @Viper9x. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

Hi @Viper9x, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

@TuVanDev
Copy link
Member

@magento give me test instance

@magento-deployment-service
Copy link

Hi @Viper9x. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@TuVanDev
Copy link
Member

I confirmed this PR resolved issue #31043. Special thanks to @rogerdz for providing the fix.

@rogerdz
Copy link
Contributor Author

rogerdz commented Feb 23, 2023

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@rogerdz
Copy link
Contributor Author

rogerdz commented Feb 23, 2023

@magento run Functional Tests B2B, Functional Tests CE , Functional Tests EE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@rogerdz
Copy link
Contributor Author

rogerdz commented Feb 25, 2023

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@Den4ik
Copy link
Contributor

Den4ik commented Jan 29, 2025

@rogerdz Could you please resolve conflict?

@engcom-Dash
Copy link
Contributor

@magento run all tests

@engcom-Dash
Copy link
Contributor

@magento run all tests

@engcom-Dash
Copy link
Contributor

Hello @engcom-Hotel I have fixed all the failed automated test because of the changes done in PR. Also added automated test to verify the descending sort order functionality. Also taken care of the review comments. The 4th point is not included in the changes becuase that is no longer applicable since we are fetching the value from configuration.

Could you please review the changes ? Moving this PR for review.

Thanks!

@engcom-Hotel
Copy link
Contributor

@magento run all tests

@ct-prd-projects-boards-automation ct-prd-projects-boards-automation bot moved this from Review in Progress to Ready for Testing in Community Dashboard Jul 10, 2025
@engcom-Bravo engcom-Bravo self-assigned this Jul 11, 2025
@engcom-Bravo engcom-Bravo moved this from Ready for Testing to Testing in Progress in Community Dashboard Jul 11, 2025
@engcom-Bravo
Copy link
Contributor

@magento run all tests

@engcom-Bravo
Copy link
Contributor

Hi @rogerdz,

Thanks for the collaboration & contribution!

✔️ QA Passed

Preconditions:

  • Install fresh Magento 2.4-develop

Steps to reproduce

  • Create a category in Magento with several products in it, all have the position in the category set to the value 1
  • Go to category page

Before: ✖️ 

Screenshot 2025-07-11 at 3 12 32 pm Screenshot 2025-07-11 at 3 12 43 pm

After: ✔️

Screenshot 2025-07-11 at 3 18 19 pm Screenshot 2025-07-11 at 3 18 04 pm

Builds are failed. Hence, moving this PR to Extended Testing.

Thanks.

@engcom-Bravo engcom-Bravo moved this from Testing in Progress to Extended testing (optional) in Community Dashboard Jul 11, 2025
@engcom-Dash
Copy link
Contributor

Since we have introduced a new store configuration, SVC is failing because of it hence created internal approval JIRA for the same.

SVC: https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/36900/d2058a4e8bad2a103834a381c079f900/SemanticVersionChecker/report-magento2.html

Screenshot 2025-07-14 at 2 26 01 PM

hence moving this PR in Pending Approval.

Copy link
Contributor

@Den4ik Den4ik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @rogerdz
Could you please review my comment

Comment on lines +24 to +25
['value' => 'ASC', 'label' => __('Ascending')],
['value' => 'DESC', 'label' => __('Descending')],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion constant usage Select::SQL_ASC or Collection::SORT_ORDER_ASC is more preferable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: pending approval Project: Community Picked PRs upvoted by the community
Projects
Status: Pending Approval
Development

Successfully merging this pull request may close these issues.

Elastic Search interferes with the default sort order of products (changing newest first to oldest first)
7 participants