【问题标题】:Prestashop convertPrice doesn't convert pricePrestashop convertPrice 不转换价格
【发布时间】:2017-04-19 05:20:11
【问题描述】:

使用 Prestashop 1.6.1.4

主题功能

{convertPrice price=$total}

添加当前货币符号,但实际上并未将其转换为所选货币。

我跟随调试器运行(classes/Product.php,第 3034 行):

public static function convertPrice($params, &$smarty)
    {
        return Tools::displayPrice($params['price'], Context::getContext()->currency);
    }

这很奇怪,因为 convertPrice 最终调用 displayPrice 而Tools::convertPrice(...) 是转换货币的函数(但不添加货币符号)。

所以我把它改成:

        return Tools::displayConvertPrice($params['price'], Context::getContext()->currency);

并添加到 Tools.php

public function displayConvertPrice($price, $currency)
{
    return Tools::displayPrice(Tools::convertPrice($price, $currency), $currency);
}

我的问题: 是错误还是我遗漏了什么?

【问题讨论】:

    标签: prestashop-1.6


    【解决方案1】:

    谁知道开发人员想要什么,但有一个聪明的功能

    {convertAndFormatPrice price=$total}
    

    你想要什么。

    你可以打开/config/smarty.config.inc.php,你会看到smartysmartyRegisterFunction(yada yada)注册的所有prestashop函数。

    【讨论】:

      【解决方案2】:

      使用

      {toolsConvertPrice price=$total}
      

      这适用于我在 PS 1.6.1.12 上。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-08-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-09-30
        • 2015-03-15
        • 1970-01-01
        相关资源
        最近更新 更多