Magento get store information on any page

Magento get store information from any page In the cases where you want to display the store related information on any page or in custom locations or in extension development like getting the website details, store details etc.

$store = Mage::app()->getStore(); //Mage_Core_Model_Store object

Now to get store ID,

$storeID = $store->getStoreId();

To get store code,

$storeCode = $store->getCode();

To get store Website ID,

$websiteID = $store->getWebsiteId();

To get store name,

$storeName = $store->getName();

To get Default View store name,

$storeName = $store->getFrontendName();

To check if store is active or not,

$active = $store->getIsActive();

To get store’s Home URL,

$storeHomeURL = $store->getHomeUrl();

If you want to find store’s group name,

$storeGroupName = $store->getGroup()->getName();

If you want ADMIN Store information, admin store has ID 0. So, you can get the details of Admin Store like this:

$store = Mage::getModel('core/store')->load(0);

and then getting all the information as shown above.

Leave a Reply