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.
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
@kapildev-symberity, thank you for your report.
We've created internal ticket(s) MAGETWO-57945 to track progress on the issue.
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.
hi @isavchuk-magento, is the patch going to be available for 2.1.x?
Can someone please share the patch for this fix. thanks,
does anyone know the solution to this problem? :)
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
https://github.com/magento/magento2/commit/4091835d49d852cdbf181bee52284688be3a427a
It would be best practice to write a small module to override this block.
Hope this helps
Adam
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
4091835It 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!!!
Most helpful comment
hi @isavchuk-magento, is the patch going to be available for 2.1.x?