質問

The website is developed in the opencart and the website contains the products in Local currency(LKR) which is not supported by the 2checkout payment gateway. I want to convert the prices of the products to USD for the payment gateways & I want to maintain the prices shown in the website in the local currency(LKR)

Is it possible to use different currencies for display purpose and the payment gateway? Please suggest me the extension/methods to solve this issue.

役に立ちましたか?

解決

Finally I figured out a way to do the conversion with the open cart currency class. I have mentioned below what I have done to solve this issue.

  1. I created the USD currency in the admin panel of the opencart & make it as the sub currency. (it will automatically update the conversion rate)
  2. In the opencart payment controller (catalog\controller\payment\twocheckout.php) and I did the following changes

After $order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);

line add the following code

$order_info['currency_code'] = 'USD';

Also changed the following Line

$this->data['total'] = $this->currency->format($order_info['total'], $order_info['currency_code'], $order_info['currency_value'], false);

to

$this->data['total'] = $this->currency->format($order_info['total'], $order_info['currency_code'],'', false);

And also changed the following line

'price'       => $this->currency->format($product['price'], $order_info['currency_code'], $order_info['currency_value'], false);

to

'price'       => $this->currency->format($product['price'], $order_info['currency_code'], '', false);

After changing those two lines, it was working perfectly and the currency value is changed to USD and the conversion value is also correct.

I hope this would be useful for anyone who have trouble with opencart currencies.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top