Câu trả lời:
Hãy thử cái này:
Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
Lưu trữ mã tiền tệ, vd. đô la Mỹ
$currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
ký hiệu tiền tệ ví dụ. $
$currency_symbol = Mage::app()->getLocale()->currency( $currency_code )->getSymbol();
lưu trữ tên tiền tệ, vd. Đô la Mỹ
$currency_name = Mage::app()->getLocale()->currency( $currency_code)->getName();
Thử:
$currencyCode = '';
$currency = $order->getOrderCurrency(); //$order object
if (is_object($currency)) {
$currencyCode = $currency->getCurrencyCode();
}
$currencySymbol = Mage::app()->getLocale()->currency($currencyCode)->getSymbol();
var_dump($currencySymbol);
Sử dụng bất kỳ mã tiền tệ cụ thể nào, bạn có thể lấy ký hiệu bằng Zend_Locale:
$curr = new Zend_Currency('en_US');
echo $curr->getSymbol();
Chỉ cần chuyển giá trị trong biến .. sẽ trả về giá định dạng tiền tệ hiện tại
$Formatted_Price = Converted Price with Currency
$Variable_Price = Your Variable value
$Formatted_Price= Mage::helper('core')->currency($Variable_Price, true, false);