Skip to content

Commit

Permalink
feat: order by Pimcore Index
Browse files Browse the repository at this point in the history
  • Loading branch information
dkarlovi authored Apr 22, 2022
1 parent 6c6a3e7 commit 33fe130
Showing 1 changed file with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ public function findForStore(StoreInterface $store): array
{
$list = $this->getList();
$list->setCondition('stores LIKE ?', ['%,' . $store->getId() . ',%']);
$list->setOrderKey(
'o_index ASC, o_key ASC',
false
);
$this->setSortingForListingWithoutCategory($list);

return $list->getObjects();
}
Expand All @@ -38,10 +35,8 @@ public function findFirstLevelForStore(StoreInterface $store): array
{
$list = $this->getList();
$list->setCondition('parentCategory__id is null AND stores LIKE "%,' . $store->getId() . ',%"');
$list->setOrderKey(
'o_index ASC, o_key ASC',
false
);

$this->setSortingForListingWithoutCategory($list);

return $list->getObjects();
}
Expand Down Expand Up @@ -116,7 +111,7 @@ private function setSortingForListing(Listing $list, CategoryInterface $category
private function setSortingForListingWithoutCategory(Listing $list): void
{
$list->setOrderKey(
'o_key ASC',
'o_index ASC, o_key ASC',
false
);
}
Expand Down

0 comments on commit 33fe130

Please sign in to comment.