Skip to content

Commit

Permalink
Merge pull request #925 from LameuleFR/dev
Browse files Browse the repository at this point in the history
Add sorting by reference
  • Loading branch information
kpodemski authored Sep 26, 2023
2 parents 6520282 + 1696594 commit 43a4b14
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Product/SearchProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ private function getAvailableSortOrders($query)
$sortPriceDesc = new SortOrder('product', 'price', 'desc');
$sortDateAsc = new SortOrder('product', 'date_add', 'asc');
$sortDateDesc = new SortOrder('product', 'date_add', 'desc');
$sortRefAsc = new SortOrder('product', 'reference', 'asc');
$sortRefDesc = new SortOrder('product', 'reference', 'desc');
$translator = $this->module->getTranslator();

$sortOrders = [
Expand All @@ -118,6 +120,12 @@ private function getAvailableSortOrders($query)
$sortPriceDesc->setLabel(
$translator->trans('Price, high to low', [], 'Shop.Theme.Catalog')
),
$sortRefAsc->setLabel(
$translator->trans('Reference, A to Z', [], 'Shop.Theme.Catalog')
),
$sortRefDesc->setLabel(
$translator->trans('Reference, Z to A', [], 'Shop.Theme.Catalog')
),
];

if ($query->getQueryType() == 'new-products') {
Expand Down

0 comments on commit 43a4b14

Please sign in to comment.