Skip to content

Instantly share code, notes, and snippets.

@fusco
Created July 13, 2012 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fusco/3106233 to your computer and use it in GitHub Desktop.
Save fusco/3106233 to your computer and use it in GitHub Desktop.
remplace dropdown store menu by flag
<?php if(count($this->getGroups())>1): ?>
<div class="store-switcher">
<?php foreach ($this->getGroups() as $_group): ?>
<a href="<?php echo $_group->getHomeUrl() ?>"><img
src="<?php echo $this->getSkinUrl('images/store/store_' . strtolower(str_replace(' ', '_',$this->htmlEscape($_group->getName()))) . '.png') ?>" width="30" height="20"
alt="<?php echo $this->htmlEscape($_group->getName()) ?>"/></a>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php if(count($this->getGroups())>1): ?>
<div class="store-switcher">
<label for="select-store"><?php echo $this->__('Select Store:') ?></label>
<select id="select-store" title="<?php echo $this->__('Select Store') ?>" onchange="location.href=this.value">
<?php /*foreach ($this->getStores() as $_store): ?>
<option value="<?php echo $_store->getUrl('') ?>"<?php if($_store->getId()==$this->getCurrentStoreId()): ?> selected="selected"<?php endif; ?>><?php echo $_store->getName() ?></option>
<?php endforeach;*/ ?>
<?php foreach ($this->getGroups() as $_group): ?>
<?php $_selected = ($_group->getId()==$this->getCurrentGroupId()) ? ' selected="selected"' : '' ?>
<option value="<?php echo $_group->getHomeUrl() ?>"<?php echo $_selected ?>><?php echo $this->htmlEscape($_group->getName()) ?></option>
<?php endforeach; ?>
</select>
</div>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment