문제

I want to get store list sort by sort order. How to get it?

I just use this code. Which code i need to add ?

$stores = $this->storeManager->getStores();
도움이 되었습니까?

해결책

$stores = $this->storeManager->getStores();
uasort(
    $stores,
    function (\Magento\Store\Model\Store $storeA, \Magento\Store\Model\Store $storeB) {
        return $storeA->getSortOrder() <=> $storeB->getSortOrder();
    }    
);

Now the variable $stores should contain all your stores sorted by sort_order.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top