【问题标题】:How to get currency name instead number in OXID eShop?如何在 OXID eShop 中获取货币名称而不是数字?
【发布时间】:2017-03-10 08:19:05
【问题描述】:

我正在尝试从我的网站的数据层发送一个值,该值有几个条件。 这是我目前用于从后端获取值并将其设置到数据层的代码:

currency: '[{$oView->getCurrencyCovIndex()|string_format:"%.2f"}]'

问题是这个函数的结果是从 1 到 5 的整数,每个代表一个特定的货币。 比如:

1=EUR
2=GBP
3=USD
.
.
.

我想要的是将结果转换为相应的字符串值的东西:

currency: switch(value) {
case 1:
currency = 'EUR'
break;
case 2:
currency = 'GBP'
break;
case 3:
currency = 'USD'
break;
}

该网站基于一个带有 smarty 跟踪代码模板的 oxidshop。

【问题讨论】:

  • 编辑了语法

标签: javascript php smarty google-tag-manager oxid


【解决方案1】:

在较新的 OXID 版本(使用 4.9.x 测试)中,$currency 变量可用于所有模板。像这样在您的模板中访问它:

[{assign var="sCurrencyName" value=$currency->name}]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多