Skip to content

Sort by Price not working on CatalogSearch Page in Magento 2 #12468

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

Closed
kapildev-symberity opened this issue Nov 28, 2017 · 7 comments
Closed
Assignees
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@kapildev-symberity
Copy link

kapildev-symberity commented Nov 28, 2017

I have setup Magneto ver 2.1.9. I got an issue on catalogsearch page that sort by price not working after change Product Listing Sort by Price from magento backend.

Preconditions

  1. Magneto ver. 2.1.9
  2. PHP ver. 7.0.25

Steps to reproduce

  1. Go to stores -> catalog -> catalog -> storefront -> Product Listing Sort by -> Price
  2. Save Config

Expected result

  1. Go to website and search any product
  2. By default result sorted by relevance. When change sorting from relevance to price the result should be sorted with price and in sorting dropdown price should select.

Actual result

  1. Go to website and search any product
  2. By default result sorted by relevance but when change sorting from relevance to price the result still sorted with relevance and in sorting dropdown relevance is selected.

I have also submit issue on magento stackexchange but I got suggestion to generate ticket on github.
https://magento.stackexchange.com/questions/203511/sort-by-price-not-working-on-catalogsearch-page-in-magento-2

@magento-engcom-team magento-engcom-team added Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed labels Nov 28, 2017
@magento-engcom-team
Copy link
Contributor

@kapildev-symberity, thank you for your report.
We've created internal ticket(s) MAGETWO-57945 to track progress on the issue.

@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Nov 28, 2017
@RomaKis RomaKis self-assigned this Nov 29, 2017
@ishakhsuvarov
Copy link
Contributor

ishakhsuvarov commented Dec 11, 2017

Hi @kapildev-symberity
The fix for this issue is now delivered to the 2.2-develop and should be released with the next patch release.
Thank you for collaboration.

@okorshenko okorshenko added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Dec 11, 2017
@yosefkurniawan
Copy link

yosefkurniawan commented Feb 26, 2018

hi @isavchuk-magento, is the patch going to be available for 2.1.x?

@malikt
Copy link

malikt commented Dec 8, 2018

Can someone please share the patch for this fix. thanks,

@lwojciec85
Copy link

does anyone know the solution to this problem? :)

@plumbingworld
Copy link

plumbingworld commented Jan 15, 2019

Hello, I think I have located the fix in the code base:

In magento/module-catalog/Block/Product/ProductList/Toolbar.php

Replace
'orderDefault' => $this->_productListHelper->getDefaultSortField(),

With
'orderDefault' => $this->getOrderField(),

See this commit
4091835

It would be best practice to write a small module to override this block.

Hope this helps
Adam

@earlelnar
Copy link

Hello, I think I have located the fix in the code base:

In magento/module-catalog/Block/Product/ProductList/Toolbar.php

Replace
'orderDefault' => $this->_productListHelper->getDefaultSortField(),

With
'orderDefault' => $this->getOrderField(),

See this commit
4091835

It would be best practice to write a small module to override this block.

Hope this helps
Adam

Thanks @plumbingworld

I tried your code and it fixed my problem on store running Magento 2.2.2

Thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

10 participants