1

I want to get the names(and the other info ofc.) of all the stores where I have the Magento2 Installation. I do the following:

use Magento\Store\Model\StoreFactory;
...
$this->_storeFactory = $storeFactory->create();
....
$this->_storeFactory->getCollection()->toArray();

And I get the collection into the array. However, the problem is that in the ['name'] column of each item I don't have the name of the Store, but I get the name of the Store View. I've created 3 different stores with 4 Store views - one Store hase 2 Store views, the other 2 stores have only one store view, which makes total of 4, which is the number of the items in the collection. Why is this happening, aren't store and store view to completely different things? This is kind of confusing. How can I get information for a Store like

["store_id"]=> string(1) "The id of the store, not the id of the store view" 
["code"]=> string(2) "The code of the store, not the Store view" 
["website_id"]=> string(1) "The website Id that the store belongs to" 
["group_id"]=> string(1) "1" 
["name"]=> string(7) "The actual name of the store, not the name of the view"
2

Never mind, I found it. It is actually the group_id that plays the role of the store_id. So group_id is what should be store_id (and the current store_id should be called something like store_view_id or something) and store_groups is the table where you can find the information about the store. This is so weird in my opinion, but who am I, right ? :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.