2014-03-26 83 views
0

我在這裏遇到了Magento的一個小問題。如何在貨幣符號中更改貨幣代碼縮寫Magento

如果你看看這個頁面

MY DEMO PAGE

你會看到紅色布頓與標題KUPI,價格爲9 BAM。

BAM是我的貨幣代碼,而不是我的貨幣符號。我需要用「KM」替換這個「BAM」。

在結帳時一切都很好,所有的價格都在「KM」而不是「BAM」。

這部分(帶有按鈕KUPI)的代碼是:

<div class="pull-right" id="deal-show-vitals-buy"> 
        <a onclick="submitform();" data-deal_id="<?php echo $_product->getId();?>" href="#" 
         data-toggle="modal" class="btn btn-large btn-g font-large" 
         id="buy-button"> 
         <strong>KUPI</strong> <?php echo $this->getPriceCurrency($_product->getPrice()); ?> </a> 
       </div> 

問題是這部分代碼,我想:

<?php echo $this->getPriceCurrency($_product->getPrice()); ?> 

請,任何幫助讚賞

回答

1

的核心幫手(Mage :: helper('core'))有一個方法可以用來格式化貨幣。

<?php echo Mage::helper('core')->currency($_product->getPrice()) ?> 

作爲替代方案,您也可以將貨幣符號作爲獨立選項使用。

$symbol = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol(); 
echo $symbol; 

我的建議是使用第一個選項(核心助手),因爲它是使用助手的主要目的。

參考 Magento Core Helper Documentation

+0

謝謝約翰,這是很善良的你。根據建議,我使用第一個選項,就像魅力一樣。我的感激之情 – Eager2Learn