Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Templates 如何在PrestaShop 1.7模板中获取locale对象?_Templates_Locale_Prestashop 1.7 - Fatal编程技术网

Templates 如何在PrestaShop 1.7模板中获取locale对象?

Templates 如何在PrestaShop 1.7模板中获取locale对象?,templates,locale,prestashop-1.7,Templates,Locale,Prestashop 1.7,我在模板文件中使用Tools::displayPrice()函数以货币显示格式化的价格,但新版本(1.7.6.0)中此函数的文档说明: 那么如何在模板中使用Locale对象呢 -- 附笔。 PrestaShop的官方文档:乱七八糟,因此,如果有人能分享到某个完整可靠资源的链接,我(以及更多)将非常感谢谷歌的搜索结果: Context::getContext()->currentLocale->formatPrice(123.45,'EUR') 或者,例如,在模块中 $this->context-

我在模板文件中使用
Tools::displayPrice()
函数以货币显示格式化的价格,但新版本(1.7.6.0)中此函数的文档说明:

那么如何在模板中使用
Locale
对象呢

-- 附笔。 PrestaShop的官方文档:乱七八糟,因此,如果有人能分享到某个完整可靠资源的链接,我(以及更多)将非常感谢谷歌的搜索结果:

Context::getContext()->currentLocale->formatPrice(123.45,'EUR')

或者,例如,在模块中

$this->context->currentLocale->formatPrice($price,$currencyCode)

* @deprecated Since 1.7.6.0. Please use Locale::formatPrice() instead
* @see PrestaShop\PrestaShop\Core\Localization\Locale