Reputation: 57196
How can I add currency symbols into the currency list?
This is the code,
<?php if($this->getCurrencyCount() > 1): ?>
<div class="form-micro">
<select onchange="window.location.href=this.value" name="custom-currency-selector" id="custom-currency-selector">
<?php foreach ($this->getCurrencies() as $_code => $_name): ?>
<option value="<?php echo $this->getSwitchCurrencyUrl($_code)?>"
<?php if($_code == $this->getCurrentCurrencyCode()): ?>
selected="SELECTED"
<?php endif; ?>>
<?php echo $_name ?>
</option>
<?php endforeach; ?>
</select>
</div>
<?php endif; ?>
will output,
<option ...>Euro</option>
<option ...>British Pound</option>
<option ...>Danish Krone</option>
<option ...>Swedish Krona</option>
<option ...>Swiss Franc</option>
<option ...>United States Dollars</option>
But I need to add their symbols after the text,
<option ...>Euro €</option>
<option ...>British Pound £</option>
<option ...>Danish Krone DKK</option>
<option ...>Swedish Krona SEK</option>
<option ...>Swiss Franc CHF</option>
<option ...>United States Dollars $</option>
Is it possible?
Upvotes: 1
Views: 543
Reputation: 7611
Yes,Tealou ,it is possible
,you can get this using below code
Mage::app()->getLocale()->currency($cuurencycode)->getSymbol();
Your modified code is
<?php if($this->getCurrencyCount() > 1): ?>
<div class="form-micro">
<select onchange="window.location.href=this.value" name="custom-currency-selector" id="custom-currency-selector">
<?php foreach ($this->getCurrencies() as $_code => $_name): ?>
<option value="<?php echo $this->getSwitchCurrencyUrl($_code)?>"
<?php if($_code == $this->getCurrentCurrencyCode()): ?>
selected="SELECTED"
<?php endif; ?>>
<?php echo $_name ?><?php Mage::app()->getLocale()->currency($_code)->getSymbol(); ?>
</option>
<?php endforeach; ?>
</select>
</div>
<?php endif; ?>
Upvotes: 1