如何将货币符号添加到货币列表?
这是代码,
<?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; ?>
将输出,
<option ...>Euro</option>
<option ...>British Pound</option>
<option ...>Danish Krone</option>
<option ...>Swedish Krona</option>
<option ...>Swiss Franc</option>
<option ...>United States Dollars</option>
但我需要在文字后添加符号
<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>
有可能吗?
答案 0 :(得分:1)
是的,Tealou,possible
,您可以使用以下代码
Mage::app()->getLocale()->currency($cuurencycode)->getSymbol();
您的修改后的代码是
<?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; ?>