I have created multistore in Magento. In admin panel i tried to get this multistore base url:
Below code i tried :
Mage::getStoreConfig("web/secure/base_url", 2);
Mage::getStoreConfig("web/secure/base_url", 5);
Mage::getStoreConfig("web/secure/base_url", 3);
Also i tried below code :
Mage::app()->getStore(2)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
Mage::app()->getStore(3)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
Mage::app()->getStore(5)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
If i enterd this code in the site, the page was not loaded.
My Code in admin-panel(header.phtml) :
<p class="super">
<?php echo $this->__("Logged in as %s", $this->escapeHtml($this->getUser()->getUsername())) ?><span class="separator">|</span><?php echo $this->formatDate(null, 'full') ?><span class="separator">|</span><a href="http://golinks.magento.com/CE15" onclick="this.target='_blank'" class="go-try"><?php echo $this->__('Try Magento Go for Free') ?></a><span class="separator">|</span><a href="<?php echo $this->getLogoutLink() ?>" class="link-logout"><?php echo $this->__('Log Out') ?></a>
<?php
if(Mage::helper('multistoreconfig')->multistore_config_enable()) {
echo "<select class='no-changes' id='list_store' onchange=\"popWin(this.value, '_blank')\"><option value=''>-- Select Store --</option>";
foreach (Mage::app()->getWebsites() as $websiteid => $website) {
foreach ($website->getGroups() as $group) {
$stores = $group->getStores();
foreach ($stores as $storeId => $store) {
$data = $this->checkMultiStoreConfigurInStoreId($storeId);
if( $data[0]['sub_directory'] || $storeId == 1) {
$option_url = Mage::getStoreConfig("web/secure/base_url", $storeId);
// $option_url = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
echo "<option value='". $option_url ."'>";
echo Mage::helper('multistoreconfig/data')->getStoreName($storeId);
echo "</option>";
}
}
}
}
}
echo "</select>";
?>
</p>
Any help would be appreciation.