add store in magento

In this article, the motive is you can learn to create store dropdown which is add in Magento admin. Many stores are different language and different country. Then store should be in different language or store.
Like German, Franch, English etc.
Here is code for creating dropdown of store switcher, which is manage in Magento admin. Go to system > configuration > manage store
And add multiple stores.

here is full code....

<?php
$web_site = Mage::getModel('core/website')->getCollection(); // here get all website collection
foreach($web_site as $website)
{
    $default_store = $website->getDefaultStore();
    $url_obj = new Mage_Core_Model_Url();
    $default_store_path = $url_obj->getBaseUrl(array('_store'=> $default_store->getCode()));
?>
    <option <?php if(strstr($this->helper('core/url')->getCurrentUrl(), $default_store_path)):?>selected="selected"<?php endif; ?> value="<?php echo $default_store_path ?>"><?php echo $website->getName()?></option>
<?php
}
?>

Labels: