Skip to content

Commit

Permalink
Improve sortOrder direction fallback in case of empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
romainruaud committed Oct 22, 2024
1 parent 31e6939 commit 9ca1e2d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/module-elasticsuite-virtual-category/Model/Preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ protected function prepareProductCollection(Collection $collection) : Collection
$directionFallback = $sortBy !== 'position' ? Collection::SORT_ORDER_ASC : Collection::SORT_ORDER_DESC;

$direction = $this->request->getParam('sort_direction', $directionFallback);
if (empty($direction)) {
if (empty($direction) || ((string) $direction === '')) {
$direction = $directionFallback;
}
$collection->setOrder($sortBy, $direction);
Expand Down

0 comments on commit 9ca1e2d

Please sign in to comment.