【问题标题】:How to get virtuemart store default currency details in components?如何在组件中获取德德玛特商店默认货币详细信息?
【发布时间】:2016-02-06 08:24:55
【问题描述】:

我想在我的组件中显示货币符号和货币代码,但不知道怎么做 试试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

【问题讨论】:

    标签: joomla components virtuemart


    【解决方案1】:

    试试这个,

    尝试加载 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;
    

    希望对你有所帮助。

    【讨论】:

      猜你喜欢
      • 2011-10-29
      • 1970-01-01
      • 1970-01-01
      • 2012-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-07
      • 2021-12-15
      相关资源
      最近更新 更多