Subesh Pokhrel

Magento Developers Blog

MagNotes Series : Magento Get Store by Store Code

About MagNotes Series In this blog I have always shared about what I’ve learned on Magento, which I felt is taken me one step closer to understanding Magento and Magento development. But during the course of time, I bump on some elementary things which are absolutely required. So just for those elementary things I’ve decided to create a series (MagNotes Series) , for myself as a reference or for whoever think this is helpful.
[source lang=”php”] protected function _getStoreByCode($storeCode) { $stores = array_keys(Mage::app()->getStores()); foreach($stores as $id){ $store = Mage::app()->getStore($id); if($store->getCode()==$storeCode) { return $store; } } return false; } [/source]