Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Commit

Permalink
sort menu items correctly in php
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Windell committed Dec 20, 2017
1 parent 4a5956b commit bfe667d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Helper/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ protected function _getMenuHtml($menu, $includeWrapper = false)
{
$items = $this->itemCollectionFactory->create()
->addFieldToFilter('menu_id', ['eq' => $menu->getId()])
->addFieldToFilter('parent_id', ['null' => true]);
->addFieldToFilter('parent_id', ['null' => true])
->setOrder('sort_order', 'ASC');

$menuHtml = $this->_addSubMenu($items);

Expand Down Expand Up @@ -129,6 +130,7 @@ protected function _getItemClasses($item)
protected function _getItemChildren($item)
{
return $this->itemCollectionFactory->create()
->addFieldToFilter('parent_id', ['eq' => $item->getId()]);
->addFieldToFilter('parent_id', ['eq' => $item->getId()])
->setOrder('sort_order', 'ASC');
}
}

0 comments on commit bfe667d

Please sign in to comment.