-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Different default direction in sorting for category page or catalog search #39545
Comments
Hi @venchiarutti. Thank you for your report.
Join Magento Community Engineering Slack and ask your questions in #github channel. |
Hi @engcom-Bravo. Thank you for working on this issue.
|
Hi @venchiarutti, Thanks for your reporting and collaboration. We have gone through with the description and seems to be an improvement to proceed further we are marking this as Feature Reauest. Thanks. |
Preconditions and environment
The category page default direction is defined by
When it is a catalog search magento 2 uses the value from this piece of code in the file: vendor/magento/module-catalog-search/Block/Result.php
public function setListOrders()
{
$category = $this->catalogLayer->getCurrentCategory();
/* @var $category \Magento\Catalog\Model\Category */
$availableOrders = $category->getAvailableSortByOptions();
unset($availableOrders['position']);
$availableOrders['relevance'] = __('Relevance');
$this->getListBlock()->setAvailableOrders(
$availableOrders
)->setDefaultDirection(
'desc'
)->setDefaultSortBy(
'relevance'
);
return $this;
}
But when it is in the category page it uses the value from vendor/magento/module-catalog/Block/Product/ProductList/Toolbar.php
/**
*/
protected $_direction = ProductList::DEFAULT_SORT_DIRECTION;
So it has a different default order depending on where...
The correct for such important feature should have configuration for both cases in the admin, but having a different default direction with the same toolbar understanding both as the default one is causing issues
Steps to reproduce
This can be more clearly checked by for example adding an eav_attribute to be used as sort option, in the catalog it will be in a direction and in category another one
Expected result
The correct would be having configurations for both cases
Actual result
Different sorting direction in catalog search and category page
Additional information
No response
Release note
No response
Triage and priority
The text was updated successfully, but these errors were encountered: