How to find out what my store ID is?
When you click on the specific store in Manage stores in the URL bar there should be a parameter like store_id or something like that. This is your store id. Or when in Manage stores screen if you hover over store and the link might be displayed in the right(left) corner of your browser. In the url there is store_id param. This is the easiest I guess.
Or in database there is table: core_store.
Pragmatically you can get the website id, website name, store id, store name and store code like this:
<?php
echo "Website ID: " . Mage::app()->getWebsite()->getId() . "<br/>";
echo "Website Name: " . Mage::app()->getWebsite()->getName() . "<br/>";
echo "Store ID: " . Mage::app()->getStore()->getId() . "<br/>";
echo "Store Name: ".Mage::app()->getStore()->getName(). "<br/>";
echo "Store code: ". Mage::app()->getStore()->getCode()."<br/>";
?>
Here is an example looping through all the websites and print all store id and store names you have set up in your Magento:
<?php
foreach (Mage::app()->getWebsites() as $website) {
foreach ($website->getGroups() as $group) {
$stores = $group->getStores();
foreach ($stores as $store) {
echo $store->getId() ." ".$store->getName()."<br/>";
}
}
}
?>
Screenshot to illustrate Jevgeni Smirnov's answer:
As he said, you should go to System -> Manage Stores and click on needed store name in the right column.
To get store_id
from store_code
use:
echo Mage::app()->getStore('store_code')->getId();