Page 1 of 2
Show order ID in bank transfer
Posted: Sat Aug 18, 2012 7:26 pm
by robinvanb
Hi,
I was looking for a way to show the Order ID to customers who want to use the bank transfer payment option. There are some commercial extensions that also provide this, but it turns out it's not really that hard to do yourself.
Hopefully I can help someone out in this way.
Go to: /catalog/controller/payment/bank_transfer.php
find this line of code (for me at was line 11'ish):
Code: Select all
$this->data['bank'] = nl2br($this->config->get('bank_transfer_bank_' . $this->config->get('config_language_id')));
Then add the following line directly below:
Code: Select all
$this->data['bank'] = str_replace('%order_id%', $this->session->data['order_id'], $this->data['bank']);
So the end result is two lines:
Code: Select all
$this->data['bank'] = nl2br($this->config->get('bank_transfer_bank_' . $this->config->get('config_language_id')));
$this->data['bank'] = str_replace('%order_id%', $this->session->data['order_id'], $this->data['bank']);
In the same file (/catalog/controller/payment/bank_transfer.php) find the following line in the function confirm, for me it was line 32:
Code: Select all
$comment .= $this->language->get('text_payment');
and add the following line below that:
Code: Select all
$comment = str_replace('%order_id%', $this->session->data['order_id'], $comment);
the result would be:
Code: Select all
$comment .= $this->language->get('text_payment');
$comment = str_replace('%order_id%', $this->session->data['order_id'], $comment);
Then you can go to the bank transfer payment option in the Admin panel. Type your text and where you want your order ID to be displayed you simply type %order_id%.
For instance: Wire the total amount due to bank account: 1234 and mention your order id: %order_id%
The user will see: Wire the total amount due to bank account: 1234 and mention your order id: 23
And that's it. I've tested this on version 1.5.3 but I'm sure other versions can be modified in a similar fashion.
Re: Show order ID in bank transfer
Posted: Mon Aug 20, 2012 2:43 am
by mrjave
good day Robinvanb,
this is helpful.
thank you for this.
Jave
Re: Show order ID in bank transfer
Posted: Mon Aug 20, 2012 10:48 am
by mrjave
good day Robinvanb,
i found something which i am not sure if it is solvable.
the comment is also being shown in the email sent to customer with "%order_id%" showing instead of the order ID.
do you have any fix for this?
kind regards,
Jave
Re: Show order ID in bank transfer
Posted: Mon Aug 20, 2012 4:29 pm
by robinvanb
Hi Jave,
Good find, it's not that difficult to fix.
In the same file (/catalog/controller/payment/bank_transfer.php) find the following line in the function confirm, for me it was line 32:
Code: Select all
$comment .= $this->language->get('text_payment');
and add the following line below that:
Code: Select all
$comment = str_replace('%order_id%', $this->session->data['order_id'], $comment);
the result would be:
Code: Select all
$comment .= $this->language->get('text_payment');
$comment = str_replace('%order_id%', $this->session->data['order_id'], $comment);
I have edited the first post to include this change.
Kind regards,
Robin
Re: Show order ID in bank transfer
Posted: Tue Aug 21, 2012 1:16 am
by mrjave
good day Robin,
it works.
many thanks for this!!
kind regards,
Jave
Re: Show order ID in bank transfer
Posted: Thu Sep 27, 2012 3:31 am
by crispylettuce
Hey just wanna say thanks for a good guide, i had already put in it for people to quote their order Id, but this goes one better and reminds them what it is.
Thanks

Re: Show order ID in bank transfer
Posted: Thu Dec 20, 2012 6:36 pm
by fourgood
Also works on 1.4.9.1
Should be integrated in the core. BIG THANKS!
Re: Show order ID in bank transfer
Posted: Tue Oct 22, 2013 12:54 am
by tuxman
thanks a lot!!
working on 1.5.6
Re: Show order ID in bank transfer
Posted: Fri Nov 01, 2013 7:53 pm
by burley
Thanks! Works on 1541.
Created an vqmod for it. See download link;
http://www.opencart.com/index.php?route ... n_id=14448
Re: Show order ID in bank transfer
Posted: Tue Jan 28, 2014 10:21 pm
by gastadas
Thanks a lot. But maybe it can do to show total amount.
Sorry for my really bad english.
I need the same script, that could show total amount in bank transfer
Re: Show order ID in bank transfer
Posted: Mon Dec 15, 2014 7:29 pm
by Impaler
gastadas wrote:Thanks a lot. But maybe it can do to show total amount.
Sorry for my really bad english.
I need the same script, that could show total amount in bank transfer
that would be awesome

Re: Show order ID in bank transfer
Posted: Tue Mar 03, 2015 8:46 am
by opticeye
Hi robinvanb,
I am relatively new to Opencart and currently using 2.0.1.1. I tried to follow your instructions for 'Show order ID in bank transfer', however I was apparently unsuccessful in doing so. Can you please advise if the instructions would be different for 2.0.1.1?
In addition, after adding the changes and trying a Bank Transfer order, all Bank Transfer instructions vanished from the relevant Step 6 during Checkout.
The php file after attempting your instructions read as follows...
<?php
class ControllerPaymentBankTransfer extends Controller {
public function index() {
$this->load->language('payment/bank_transfer');
$data['text_instruction'] = $this->language->get('text_instruction');
$data['text_description'] = $this->language->get('text_description');
$data['text_payment'] = $this->language->get('text_payment');
$data['button_confirm'] = $this->language->get('button_confirm');
$data['bank'] = nl2br($this->config->get('bank_transfer_bank' . $this->config->get('config_language_id')));
$data['bank'] = str_replace('%order_id%', $this->session->data['order_id'], $this->data['bank']);
$data['continue'] = $this->url->link('checkout/success');
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/bank_transfer.tpl')) {
return $this->load->view($this->config->get('config_template') . '/template/payment/bank_transfer.tpl', $data);
} else {
return $this->load->view('default/template/payment/bank_transfer.tpl', $data);
}
}
public function confirm() {
if ($this->session->data['payment_method']['code'] == 'bank_transfer') {
$this->load->language('payment/bank_transfer');
$this->load->model('checkout/order');
$comment = $this->language->get('text_instruction') . "\n\n";
$comment .= $this->config->get('bank_transfer_bank' . $this->config->get('config_language_id')) . "\n\n";
$comment .= $this->language->get('text_payment');
$comment = str_replace('%order_id%', $this->session->data['order_id'], $comment);
$this->model_checkout_order->addOrderHistory($this->session->data['order_id'], $this->config->get('bank_transfer_order_status_id'), $comment, true);
}
}
}
Please help.
Re: Show order ID in bank transfer
Posted: Tue Apr 07, 2015 9:39 pm
by j-rad
Thanks for this, robinvanb.
I've made a vQmod version of this and have tested it on my 2.0.1.1 installation, anyone who'd like a copy is welcome to it. Just save it as an XML file in your vqmod/xml folder.
Code: Select all
<modification>
<id><![CDATA[Add order ID to bank transfer payments]]></id>
<version><![CDATA[1.0]]></version>
<opencart><![CDATA[2.0.1.X]]></opencart>
<vqmver><![CDATA[2.5.1]]></vqmver>
<author><![CDATA[J-rad]]></author>
<file name="/catalog/controller/payment/bank_transfer.php">
<operation>
<search position="after"><![CDATA[
$data['bank'] = nl2br($this->config->get('bank_transfer_bank' . $this->config->get('config_language_id')));
]]></search>
<add><![CDATA[
$data['bank'] = str_replace('%order_id%', $this->session->data['order_id'], $data['bank']);
]]></add>
</operation>
<operation>
<search position="after"><![CDATA[
$comment .= $this->language->get('text_payment');
]]></search>
<add><![CDATA[
$comment = str_replace('%order_id%', $this->session->data['order_id'], $comment);
]]></add>
</operation>
</file>
</modification>
I needed to adapt this to work with an extension I use,
Order Number Manager, so if on the odd chance you also use that, here's the version I made to work with it:
Code: Select all
<modification>
<id><![CDATA[Add order ID to bank transfer payments]]></id>
<version><![CDATA[1.0]]></version>
<opencart><![CDATA[2.0.1.X]]></opencart>
<vqmver><![CDATA[2.5.1]]></vqmver>
<author><![CDATA[J-rad]]></author>
<file name="/catalog/controller/payment/bank_transfer.php">
<operation>
<search position="after"><![CDATA[
$data['bank'] = nl2br($this->config->get('bank_transfer_bank' . $this->config->get('config_language_id')));
]]></search>
<add><![CDATA[
$oc_order_id = $this->session->data['order_id'];
$rand_order_id = $this->db->query("SELECT order_id_user FROM `" . DB_PREFIX . "order` WHERE order_id = '$oc_order_id'");
$rand_order_id = $rand_order_id->row['order_id_user'];
$data['bank'] = str_replace('%order_id%', $rand_order_id, $data['bank']);
]]></add>
</operation>
<operation>
<search position="after"><![CDATA[
$comment .= $this->language->get('text_payment');
]]></search>
<add><![CDATA[
$oc_order_id = $this->session->data['order_id'];
$rand_order_id = $this->db->query("SELECT order_id_user FROM `" . DB_PREFIX . "order` WHERE order_id = '$oc_order_id'");
$rand_order_id = $rand_order_id->row['order_id_user'];
$comment = str_replace('%order_id%', $rand_order_id, $comment);
]]></add>
</operation>
</file>
</modification>
Re: Show order ID in bank transfer
Posted: Mon May 18, 2015 7:06 am
by aljawaid
j-rad wrote:Thanks for this, robinvanb.
I've made a vQmod version of this and have tested it on my 2.0.1.1 installation, anyone who'd like a copy is welcome to it. Just save it as an XML file in your vqmod/xml folder.
Code: Select all
<modification>
<id><![CDATA[Add order ID to bank transfer payments]]></id>
<version><![CDATA[1.0]]></version>
<opencart><![CDATA[2.0.1.X]]></opencart>
<vqmver><![CDATA[2.5.1]]></vqmver>
<author><![CDATA[J-rad]]></author>
<file name="/catalog/controller/payment/bank_transfer.php">
<operation>
<search position="after"><![CDATA[
$data['bank'] = nl2br($this->config->get('bank_transfer_bank' . $this->config->get('config_language_id')));
]]></search>
<add><![CDATA[
$data['bank'] = str_replace('%order_id%', $this->session->data['order_id'], $data['bank']);
]]></add>
</operation>
<operation>
<search position="after"><![CDATA[
$comment .= $this->language->get('text_payment');
]]></search>
<add><![CDATA[
$comment = str_replace('%order_id%', $this->session->data['order_id'], $comment);
]]></add>
</operation>
</file>
</modification>
I needed to adapt this to work with an extension I use,
Order Number Manager, so if on the odd chance you also use that, here's the version I made to work with it:
Code: Select all
<modification>
<id><![CDATA[Add order ID to bank transfer payments]]></id>
<version><![CDATA[1.0]]></version>
<opencart><![CDATA[2.0.1.X]]></opencart>
<vqmver><![CDATA[2.5.1]]></vqmver>
<author><![CDATA[J-rad]]></author>
<file name="/catalog/controller/payment/bank_transfer.php">
<operation>
<search position="after"><![CDATA[
$data['bank'] = nl2br($this->config->get('bank_transfer_bank' . $this->config->get('config_language_id')));
]]></search>
<add><![CDATA[
$oc_order_id = $this->session->data['order_id'];
$rand_order_id = $this->db->query("SELECT order_id_user FROM `" . DB_PREFIX . "order` WHERE order_id = '$oc_order_id'");
$rand_order_id = $rand_order_id->row['order_id_user'];
$data['bank'] = str_replace('%order_id%', $rand_order_id, $data['bank']);
]]></add>
</operation>
<operation>
<search position="after"><![CDATA[
$comment .= $this->language->get('text_payment');
]]></search>
<add><![CDATA[
$oc_order_id = $this->session->data['order_id'];
$rand_order_id = $this->db->query("SELECT order_id_user FROM `" . DB_PREFIX . "order` WHERE order_id = '$oc_order_id'");
$rand_order_id = $rand_order_id->row['order_id_user'];
$comment = str_replace('%order_id%', $rand_order_id, $comment);
]]></add>
</operation>
</file>
</modification>
Do you think this would work on v2.0.2.0?
Re: Show order ID in bank transfer
Posted: Wed Jun 03, 2015 12:14 pm
by abda11ah
Here is the OCMod version (it has been tested on Opencart 2.0.3.1)
Re: Show order ID in bank transfer
Posted: Wed Jun 03, 2015 7:05 pm
by aljawaid
abda11ah wrote:Here is the OCMod version (it has been tested on Opencart 2.0.3.1)
Thanks Abda11ah

Re: Show order ID in bank transfer
Posted: Tue Oct 27, 2015 9:24 pm
by IcyFrosty
I would like to use this OCMOD but could you please kindly advise me how to download this OCMOD into my opencart? Should the zip file be unzipped first? I tried uploading the file in ADMIN/EXTENSION/Extension Installer but keeps getting error that the file cannot be uploaded.
Re: Show order ID in bank transfer
Posted: Tue Oct 27, 2015 9:44 pm
by IcyFrosty
I tried adding the two lines you gave in the catalog/controller/payment/bank_transfer.php file but I get the following error when I am checking out using bank transfer payment.
Notice: Indirect modification of overloaded property ControllerPaymentBankTransfer::$data has no effect in /home/thewines/public_html/catalog/controller/payment/bank_transfer.php on line 16
I am using OCversion 2.0.3.1
Re: Show order ID in bank transfer
Posted: Wed Jun 27, 2018 4:47 pm
by sanshay
Works on versions from 2.x and also on 3.0.2
I have 5 weshops with different versions. Now 2 are upgraded to 3.0.2 so tests or 100% ok
I'm using this in catalog/controller/extension/payment/bank_transfer.php
Find:
Code: Select all
$data['bank'] = nl2br($this->config->get('bank_transfer_bank' . $this->config->get('config_language_id')));
Add below:
Code: Select all
$data['bank'] = str_replace('%order_id%', $this->session->data['order_id'], $data['bank']);
Find:
Code: Select all
$comment .= $this->language->get('text_payment');
Add below
Code: Select all
$comment = str_replace('%order_id%', $this->session->data['order_id'], $comment);
In admin / extensions / payments/ banktranfer and add your text for the payment with the order id code.
Example
Code: Select all
Please pay your payment on the following account number stating your order number: %order_id%

Re: Show order ID in bank transfer
Posted: Sat Nov 28, 2020 10:51 pm
by algis789
gastadas wrote: ↑Tue Jan 28, 2014 10:21 pm
Thanks a lot. But maybe it can do to show total amount.
Sorry for my really bad english.
I need the same script, that could show total amount in bank transfer
maybe you know how to make that display and total?