Post by robinvanb » Sat Aug 18, 2012 7:26 pm

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.
Last edited by robinvanb on Mon Aug 20, 2012 4:30 pm, edited 1 time in total.

Newbie

Posts

Joined
Sat Aug 18, 2012 7:18 pm

Post by mrjave » Mon Aug 20, 2012 2:43 am

good day Robinvanb,

this is helpful.
thank you for this.

Jave

Active Member

Posts

Joined
Wed Jun 13, 2012 4:22 pm

Post by mrjave » Mon Aug 20, 2012 10:48 am

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

Active Member

Posts

Joined
Wed Jun 13, 2012 4:22 pm

Post by robinvanb » Mon Aug 20, 2012 4:29 pm

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

Newbie

Posts

Joined
Sat Aug 18, 2012 7:18 pm

Post by mrjave » Tue Aug 21, 2012 1:16 am

good day Robin,

it works.
many thanks for this!!

kind regards,
Jave

Active Member

Posts

Joined
Wed Jun 13, 2012 4:22 pm

Post by crispylettuce » Thu Sep 27, 2012 3:31 am

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 :)

Active Member

Posts

Joined
Fri Aug 03, 2012 8:54 pm

Post by fourgood » Thu Dec 20, 2012 6:36 pm

Also works on 1.4.9.1
Should be integrated in the core. BIG THANKS!

Active Member

Posts

Joined
Wed Oct 20, 2010 9:49 pm

Post by tuxman » Tue Oct 22, 2013 12:54 am

thanks a lot!!

working on 1.5.6

Newbie

Posts

Joined
Sun Jul 21, 2013 4:15 pm

Post by burley » Fri Nov 01, 2013 7:53 pm

Thanks! Works on 1541.

Created an vqmod for it. See download link;

http://www.opencart.com/index.php?route ... n_id=14448

User avatar
Active Member

Posts

Joined
Sun Oct 09, 2011 3:30 pm

Post by gastadas » 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

Newbie

Posts

Joined
Tue Jan 28, 2014 6:50 pm

Post by Impaler » Mon Dec 15, 2014 7:29 pm

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 :)

New member

Posts

Joined
Fri Aug 24, 2012 3:11 am

Post by opticeye » Tue Mar 03, 2015 8:46 am

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.

Newbie

Posts

Joined
Tue Mar 03, 2015 8:30 am

Post by j-rad » Tue Apr 07, 2015 9:39 pm

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>

Newbie

Posts

Joined
Tue Apr 07, 2015 9:13 pm

Post by aljawaid » Mon May 18, 2015 7:06 am

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?

Total e-commerce newbie bravely testing OC v2.0.3.1 before rolling it live...getting there slowly, somehow. Maybe not. I dunno.


Active Member

Posts

Joined
Fri Oct 10, 2014 10:33 pm
Location - UK

Post by abda11ah » Wed Jun 03, 2015 12:14 pm

Here is the OCMod version (it has been tested on Opencart 2.0.3.1)

Newbie

Posts

Joined
Wed Mar 28, 2012 3:11 pm

Post by aljawaid » Wed Jun 03, 2015 7:05 pm

abda11ah wrote:Here is the OCMod version (it has been tested on Opencart 2.0.3.1)
Thanks Abda11ah :)

Total e-commerce newbie bravely testing OC v2.0.3.1 before rolling it live...getting there slowly, somehow. Maybe not. I dunno.


Active Member

Posts

Joined
Fri Oct 10, 2014 10:33 pm
Location - UK

Post by IcyFrosty » Tue Oct 27, 2015 9:24 pm

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.

Newbie

Posts

Joined
Thu Oct 22, 2015 11:04 pm

Post by IcyFrosty » Tue Oct 27, 2015 9:44 pm

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

Newbie

Posts

Joined
Thu Oct 22, 2015 11:04 pm

Post by sanshay » Wed Jun 27, 2018 4:47 pm

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%
Image

Attachments

2018-06-27_105210.jpg

2018-06-27_105210.jpg (33.47 KiB) Viewed 36593 times


Active Member

Posts

Joined
Fri Jan 25, 2013 8:49 pm

Post by algis789 » Sat Nov 28, 2020 10:51 pm

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?

New member

Posts

Joined
Wed Oct 14, 2020 10:15 pm
Who is online

Users browsing this forum: No registered users and 23 guests