Opencart 如何在产品页面中显示所有货币的价格?

Opencart 如何在产品页面中显示所有货币的价格?,opencart,opencart2.x,opencart-3,Opencart,Opencart2.x,Opencart 3,如何在产品页面中显示所有货币的价格 我在管理面板中添加了三种货币。我选择其中一种作为主要货币。然后我加上了产品的价格 当我浏览产品页面时,我只看到主货币的价格。如何在产品页面中显示所有货币的价格 问你,回答更实用和有用!谢谢大家! OpenCart 3.0.2.0,默认主题 您需要编辑这两个文件: 1)控制器文件 catalog\controller\product\product.php catalog\view\theme\default\template\product\product.

如何在产品页面中显示所有货币的价格

我在管理面板中添加了三种货币。我选择其中一种作为主要货币。然后我加上了产品的价格

当我浏览产品页面时,我只看到主货币的价格。如何在产品页面中显示所有货币的价格


问你,回答更实用和有用!谢谢大家!

OpenCart 3.0.2.0,默认主题

您需要编辑这两个文件:

1)控制器文件

catalog\controller\product\product.php
catalog\view\theme\default\template\product\product.twig
查找

$results = $this->model_catalog_product->getProductImages($this->request->get['product_id']);
if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
    $data['price'] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
} else {
    $data['price'] = false;
}
<h2>{{ price }}</h2>
在它之后添加

$currencies = $this->model_localisation_currency->getCurrencies();
查找

$results = $this->model_catalog_product->getProductImages($this->request->get['product_id']);
if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
    $data['price'] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
} else {
    $data['price'] = false;
}
<h2>{{ price }}</h2>
将其更改为

$data['price'] = array();
if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
    foreach ($currencies as $currency) {
        if ($currency['status']) {
            $data['price'][] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')), $currency['code']);
        }
    }
}
{% for currency_price in price %}
    <h2>{{ currency_price }}</h2>
{% endfor %}
2)查看文件

catalog\controller\product\product.php
catalog\view\theme\default\template\product\product.twig
查找

$results = $this->model_catalog_product->getProductImages($this->request->get['product_id']);
if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
    $data['price'] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
} else {
    $data['price'] = false;
}
<h2>{{ price }}</h2>
{{price}
将其更改为

$data['price'] = array();
if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
    foreach ($currencies as $currency) {
        if ($currency['status']) {
            $data['price'][] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')), $currency['code']);
        }
    }
}
{% for currency_price in price %}
    <h2>{{ currency_price }}</h2>
{% endfor %}
{price%中的货币价格百分比}
{{货币价格}
{%endfor%}

然后清除所有缓存(ocmod缓存、twig缓存、vqmod缓存)。

你很酷!谢谢你,给我一些信息如何创建模块在开放式购物车3与管理部分你是欢迎的。查看现有模块,如最新模块。然后创建自己的模块。