Magento – Getting Store Information, Name, Codes, etc

Just a quick post tonight – came across a site that I wanted to use a PHP Dynamic Copyright function, but wanted to use the Magento Store Names due to multiple storefronts being used. A quick list of Magento’s store information below:

Returns Magento Store Information:

Mage::app()->getStore();

Returns the current store’s ID

Mage::app()->getStore()->getStoreId();

Returns current store code

Mage::app()->getStore()->getCode();

Returns current store’s website Id

Mage::app()->getStore()->getWebsiteId();

Returns current store name

Mage::app()->getStore()->getName();

Returns true or false of the current store’s active state (enabled/disabled basically)

Mage::app()->getStore()->getIsActive();

Returns current store’s homepage URL

Mage::app()->getStore()->getHomeUrl();

Extra:
Dynamic Copyright (© Year – Year Store Name)

<?php
	echo "&copy;";
	$startYear = 2013;  
	$currentYear = date('Y');  
	echo $startYear . (($startYear != $currentYear) ? '-' . $currentYear : ''); 
	echo Mage::app()->getStore()->getName();
?>
Posted in Magento, Magento Enterprise, PHP