2015-11-05 57 views
0

我想顯示貨幣符號和貨幣代碼在我的組件,但不知道該怎麼辦呢 嘗試ID如何在組件中獲得virtmart商店默認貨幣詳細信息?

if (!class_exists('currencydisplay')) 
    require(JPATH_ADMINISTRATOR .'/components/com_virtuemart/helpers/currencydisplay.php'); 
    $currency = CurrencyDisplay::getInstance(); 

echo '<pre>'; 
print_r($currency); 
exit; 

但throughing這樣的錯誤..

Class 'VmModel' not found in /administrator/components/com_virtuemart/helpers/currencydisplay.php on line 46 

回答

0

試試這個,

而不是加載貨幣模式嘗試加載虛擬機配置類,然後您將可以訪問像下面的所有虛擬機模型。

if (!class_exists('VmConfig')) require(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_virtuemart'.DS.'helpers'.DS.'config.php'); 
     $config = VmConfig::loadConfig(); 


    $currency_model = VmModel::getModel('currency'); 
    $displayCurrency = $currency_model->getCurrency($this->product->product_currency); 

    echo $displayCurrency->currency_name; 
    echo $displayCurrency->currency_code_3; 
    echo $displayCurrency->currency_symbol; 

希望這可以幫助你。

相關問題