list of websites in magento

If you want to know what websites and how many are installed in magento you can get that information from getWebsites method of the Mage_Core_Model_App object.

$storeCodeAsKey = true;

$websitesCollection = Mage::app()->getWebsites(false,$storeCodeAsKey);

	echo "<pre>";
	
	print_r(count($websitesCollection) . "\n");
		
	foreach ($websitesCollection as $website => $value)
	{
		print_r(($storeCodeAsKey ? "Store Code:":"Store Id:") . $website . "\n");
	}
	echo "</pre>";
This entry was posted in magento, php and tagged , , , . Bookmark the permalink.