如何在组件中获得virtuemart store默认货币详细信息?

时间:2015-11-05 13:19:19

标签: joomla components virtuemart

我想在我的组件中显示货币符号和货币代码,但不知道如何操作 试试id

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

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

但它正在经历像......这样的错误。

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

1 个答案:

答案 0 :(得分:0)

试试这个,

尝试加载VM配置类,而不是加载货币模式,然后您将可以访问所有VM模型,如下所示。

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;

希望这会对你有所帮助。