From 8c052c70cb52674d9958111ac0dcd85e011e5945 Mon Sep 17 00:00:00 2001 From: mayankamencherla Date: Sat, 15 Apr 2017 14:18:35 +0530 Subject: [PATCH 1/4] [multi currency] Added multi currency for open cart 1.5 --- catalog/controller/payment/razorpay.php | 13 ++++++++++--- .../theme/default/template/payment/razorpay.tpl | 5 +++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/catalog/controller/payment/razorpay.php b/catalog/controller/payment/razorpay.php index f2e7c2b..334afac 100755 --- a/catalog/controller/payment/razorpay.php +++ b/catalog/controller/payment/razorpay.php @@ -16,9 +16,16 @@ protected function index() $order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']); + $display_total = $this->currency->format($order_info['total'], $order_info['currency_code'], $order_info['currency_value'], false); + + $this->data['currency_code'] = 'INR'; + $this->data['display_currency'] = $order_info['currency_code']; + $this->data['display_total'] = number_format($display_total, 2, '.', ''); + $this->data['total'] = $this->currency->format($order_info['total'], 'INR', 1, false) * 100; + $this->data['key_id'] = $this->config->get('razorpay_key_id'); - $this->data['currency_code'] = $order_info['currency_code']; - $this->data['total'] = $this->currency->format($order_info['total'], $order_info['currency_code'], $order_info['currency_value'], false) * 100; + // $this->data['currency_code'] = $order_info['currency_code']; + // $this->data['total'] = $this->currency->format($order_info['total'], $order_info['currency_code'], $order_info['currency_value'], false) * 100; $this->data['merchant_order_id'] = $this->session->data['order_id']; $this->data['card_holder_name'] = $order_info['payment_firstname'].' '.$order_info['payment_lastname']; $this->data['email'] = $order_info['email']; @@ -30,7 +37,7 @@ protected function index() if (file_exists(DIR_TEMPLATE.$this->config->get('config_template').'/template/payment/razorpay.tpl')) { $this->template = $this->config->get('config_template').'/template/payment/razorpay.tpl'; } else { - $this->template = 'default/template/payment/razorpay.tpl'; + $this->template = 'payment/razorpay.tpl'; } $this->render(); diff --git a/catalog/view/theme/default/template/payment/razorpay.tpl b/catalog/view/theme/default/template/payment/razorpay.tpl index 6aaa950..8c8e8df 100644 --- a/catalog/view/theme/default/template/payment/razorpay.tpl +++ b/catalog/view/theme/default/template/payment/razorpay.tpl @@ -34,6 +34,11 @@ } } else { if(!razorpay_instance){ + + razorpay_options.display_currency = ""; + razorpay_options.display_amount = ""; + razorpay_instance = new Razorpay(razorpay_options); if(razorpay_submit_btn){ razorpay_submit_btn.disabled = false; From 3b85bffa6f454a3ad4f17b75cd68cae47599e856 Mon Sep 17 00:00:00 2001 From: mayankamencherla Date: Sat, 15 Apr 2017 14:32:52 +0530 Subject: [PATCH 2/4] [multi currency] removed unnecessary comments --- catalog/controller/payment/razorpay.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/catalog/controller/payment/razorpay.php b/catalog/controller/payment/razorpay.php index 334afac..e8cb5cd 100755 --- a/catalog/controller/payment/razorpay.php +++ b/catalog/controller/payment/razorpay.php @@ -24,8 +24,6 @@ protected function index() $this->data['total'] = $this->currency->format($order_info['total'], 'INR', 1, false) * 100; $this->data['key_id'] = $this->config->get('razorpay_key_id'); - // $this->data['currency_code'] = $order_info['currency_code']; - // $this->data['total'] = $this->currency->format($order_info['total'], $order_info['currency_code'], $order_info['currency_value'], false) * 100; $this->data['merchant_order_id'] = $this->session->data['order_id']; $this->data['card_holder_name'] = $order_info['payment_firstname'].' '.$order_info['payment_lastname']; $this->data['email'] = $order_info['email']; From 6c3c3fd3470aeb774d86d1cc6d21580b7d191eb0 Mon Sep 17 00:00:00 2001 From: mayankamencherla Date: Sat, 15 Apr 2017 19:32:08 +0530 Subject: [PATCH 3/4] [multi currency] Minor bug fix --- catalog/controller/payment/razorpay.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/catalog/controller/payment/razorpay.php b/catalog/controller/payment/razorpay.php index e8cb5cd..f6fa71f 100755 --- a/catalog/controller/payment/razorpay.php +++ b/catalog/controller/payment/razorpay.php @@ -21,7 +21,7 @@ protected function index() $this->data['currency_code'] = 'INR'; $this->data['display_currency'] = $order_info['currency_code']; $this->data['display_total'] = number_format($display_total, 2, '.', ''); - $this->data['total'] = $this->currency->format($order_info['total'], 'INR', 1, false) * 100; + $this->data['total'] = (int) round($this->currency->format($order_info['total'], 'INR', 1, false) * 100); $this->data['key_id'] = $this->config->get('razorpay_key_id'); $this->data['merchant_order_id'] = $this->session->data['order_id']; @@ -73,7 +73,7 @@ public function callback() $merchant_order_id = $request_params['merchant_order_id']; $order_info = $this->model_checkout_order->getOrder($merchant_order_id); - $amount = $this->currency->format($order_info['total'], $order_info['currency_code'], $order_info['currency_value'], false) * 100; + $amount = (int) round($this->currency->format($order_info['total'], 'INR', 1, false) * 100); $success = false; $error = ''; From 087a1ee9a1db5a3f8a2f9fc99149918d06950ca0 Mon Sep 17 00:00:00 2001 From: mayankamencherla Date: Thu, 28 Dec 2017 00:08:20 +0530 Subject: [PATCH 4/4] [1.5 multi currency] Using default template payment razorpay.tpl --- catalog/controller/payment/razorpay.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/controller/payment/razorpay.php b/catalog/controller/payment/razorpay.php index f6fa71f..548c4e4 100755 --- a/catalog/controller/payment/razorpay.php +++ b/catalog/controller/payment/razorpay.php @@ -35,7 +35,7 @@ protected function index() if (file_exists(DIR_TEMPLATE.$this->config->get('config_template').'/template/payment/razorpay.tpl')) { $this->template = $this->config->get('config_template').'/template/payment/razorpay.tpl'; } else { - $this->template = 'payment/razorpay.tpl'; + $this->template = 'default/template/payment/razorpay.tpl'; } $this->render();