Friday, August 19, 2011

How to show all stores in magento top menu?

Edit "app/design/frontend/<your theme>/<your theme>/template/catalog/navigation/top.phtml".
Add the below code before the line <?php echo $_menu ?>
<li onmouseover="toggleMenu(this,1)" onmouseout="toggleMenu(this,0)" class="level0 first nav-store <?php if(strpos($_SERVER['REQUEST_URI'], '?___store') && !strpos($_SERVER['REQUEST_URI'], '?___store=default')): echo 'active'; else: echo ''; endif; ?>">
      <a href="<?php echo $this->getUrl() ?>"><span><?php echo $this->__('SHOP BY BRAND') ?></span></a>
          <?php $store_groups = Mage::app()->getStores(); ?>
           <?php if(count($store_groups)>1): ?>            
               <ul class="level0">
                <?php $level_counter = 1;?>
                <?php foreach ($store_groups as $_eachStoreId => $val): ?>  
                   <li class="level1 nav-home-<?php echo $level_counter;?>">
                      <a href="<?php echo Mage::app()->getStore($_eachStoreId)->getHomeUrl() ?>"><span><?php echo Mage::app()->getStore($_eachStoreId)->getName(); ?></span></a>
                   </li>
                   <?php $level_counter++;?>
                <?php endforeach; ?>
               </ul>
          <?php endif; ?>

No comments:

Post a Comment