I get store categories from category helper, i need to order categories by entity id with my array. Here is my code
\Magento\Catalog\Helper\Category $categoryHelper,
...
$this->_categoryHelper = $categoryHelper;
public function getStoreCategories($sorted = true, $asCollection = true, $toLoad = true)
{
$order = array(2,6,3,4,5);
$menuitems = $this->_categoryHelper
->getStoreCategories($sorted , $asCollection, $toLoad)
->addAttributeToFilter('entity_id', $order)
->addAttributeToFilter('include_in_menu', array('eq' => 1));
return $menuitems;
}
Can somebody help me ?
Thanks