Post by burley » Tue Oct 01, 2019 9:57 pm

I'm trying to clone my payment method (bank transfer) as I have some different instructions for different customer groups and I will be working with a module which allows me to set different payment methods per group.

I found all files, copied them, renamed them and updated the "bank_transfer" in the code to the new name (ie 60daynet) and uploaded all of them. The payment method showes in the admin panel, so so far so good...

However, when I hit install, it gives me an internal server error, although after refreshing the list it does show as installed. But when I try to edit it, a new error appears (http 500).

The error log shows errors, but not something which I can use or has anything to do with the payment methods:
Undefined variable: username in admin/view/template/common/column_left.tpl on line 5
Can anyone tell me how to make this work?

User avatar
Active Member

Posts

Joined
Sun Oct 09, 2011 3:30 pm

Post by by mona » Tue Oct 01, 2019 10:25 pm

you can try this from this thread
- not sure which OC version you are using - the previous OP was using or which OC version cyclops is referring to .. but worth a try ..
viewtopic.php?f=190&t=214049
cyclops12 wrote:
Sun Sep 29, 2019 11:12 pm
I found this happens when you add an image in your user settings.
To get round this error you need to goto admin/controller/common/column_left.php and find around line 15

Code: Select all

$data['lastname'] = $user_info['lastname'];
Add underneath

Code: Select all

$data['username'] = $user_info['username'];
Refresh caches and no more error 8)

Looks like something they forgot to add into the code as it was in previous versions

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by burley » Tue Oct 01, 2019 11:05 pm

I'm using 2.3.02

Thanks for the tip, tried it, but no difference. The error still is present. Exactly the same. The line which is referred to is below:

Code: Select all

$this->load->language('common/column_left');

User avatar
Active Member

Posts

Joined
Sun Oct 09, 2011 3:30 pm

Post by cyclops12 » Wed Oct 02, 2019 12:54 am

The solution i posted was for 2302
The line you posted above is line 5 from the controller file and not line 5 from the tpl file as indicated by your first post
Are you using default theme?

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by burley » Wed Oct 02, 2019 2:08 am

Yes, you are right! Apologies. Below is the line from the tpl file and yes I'm using the default theme.

Code: Select all

      <img src="<?php echo $image; ?>" alt="<?php echo $firstname; ?> <?php echo $lastname; ?>" title="<?php echo $username; ?>" class="img-circle" />

User avatar
Active Member

Posts

Joined
Sun Oct 09, 2011 3:30 pm

Post by burley » Wed Oct 02, 2019 2:14 am

So I removed the below code from the tpl file which resolved the error. But it makes no difference for the added/copied payment module.

User avatar
Active Member

Posts

Joined
Sun Oct 09, 2011 3:30 pm

Post by by mona » Wed Oct 02, 2019 2:17 am

You may need to pay someone to look into this for you.

I suggest you try again the above solution and make sure you are following the instructions correctly

THIS FILE
admin/controller/common/column_left.php

AFTER THIS LINE
$data['lastname'] = $user_info['lastname'];

ADD THIS CODE
$data['username'] = $user_info['username'];


and make sure you clear your cache

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by by mona » Wed Oct 02, 2019 2:25 am

and following that same thread with the same problem
Post by Majna » Wed Oct 02, 2019 1:58 am
by mona wrote: ↑
Sun Sep 29, 2019 10:46 pm
something you did today?
did you add an extension recently ?
have you checked what is on line 5 of column-left and followed that backwards ?
I solved it. I uninstall last installed extension. Then it work.

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by by mona » Wed Oct 02, 2019 2:35 am

maybe this will be of assistance regarding your module

viewtopic.php?t=105109

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by cyclops12 » Wed Oct 02, 2019 2:36 am

burley wrote:
Wed Oct 02, 2019 2:14 am
So I removed the below code from the tpl file which resolved the error. But it makes no difference for the added/copied payment module.
Not sure what exactly you removed but if its working then hey, its only to display your name and username in admin so no biggie

As for the copied module i would go through each file thoroughly and make sure you havent missed/copied/deleted something

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by burley » Wed Oct 02, 2019 2:45 am

Below are the first couple of lines of code from the admin/controller/common/column_left.php file

Code: Select all

<?php
class ControllerCommonColumnLeft extends Controller {
	public function index() {
		if (isset($this->request->get['token']) && isset($this->session->data['token']) && ($this->request->get['token'] == $this->session->data['token'])) {
			$this->load->language('common/column_left');
	
			$this->load->model('user/user');
	
			$this->load->model('tool/image');
	
			$user_info = $this->model_user_user->getUser($this->user->getId());
	
			if ($user_info) {
				$data['firstname'] = $user_info['firstname'];
				$data['lastname'] = $user_info['lastname'];
				$data['username'] = $user_info['username'];
	
				$data['user_group'] = $user_info['user_group'];
But this issue is solved, as I removed the title tag from the colomn_left.tpl file which is what caused the error (and does nothing).

As I install the updated payment module it still gives me 2 errors, but there is no more notice in the error log. The same applies when I try to edit the module (as after refreshing it does show as installed) or when I uninstall the module.

I added the files below.

User avatar
Active Member

Posts

Joined
Sun Oct 09, 2011 3:30 pm

Post by burley » Wed Oct 02, 2019 2:59 am

by mona wrote:
Wed Oct 02, 2019 2:35 am
maybe this will be of assistance regarding your module

viewtopic.php?t=105109
Defenitely interesting!

User avatar
Active Member

Posts

Joined
Sun Oct 09, 2011 3:30 pm

Post by burley » Wed Oct 02, 2019 3:38 am

cyclops12 wrote:
Wed Oct 02, 2019 2:36 am
Not sure what exactly you removed but if its working then hey, its only to display your name and username in admin so no biggie
This is what I removed

Code: Select all

title="<?php echo $username; ?>"

User avatar
Active Member

Posts

Joined
Sun Oct 09, 2011 3:30 pm

Post by cyclops12 » Wed Oct 02, 2019 4:05 am

That is just to show your username when you hover over your admin image so not important.
As for your module i can see one error in the catalog/model/extension/payment/60daynet.php
On line 2 you have

Code: Select all

class ModelExtensionPaymentBankTransfer extends Model {
This should be

Code: Select all

class ModelExtensionPayment60DayNet extends Model {

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by burley » Wed Oct 02, 2019 5:12 am

cyclops12 wrote:
Wed Oct 02, 2019 4:05 am
That is just to show your username when you hover over your admin image so not important.
As for your module i can see one error in the catalog/model/extension/payment/60daynet.php
Thanks!! I found another one, in controller/extension/payment/60daynet.php. It solved the install/uninstall error.
But, I'm still unable to edit the settings. I noticed in the admin template file the following ID is mentioned multiple times: "form-bank-transfer". Example below.
Should I change this as well?

Code: Select all

      <div class="pull-right">
        <button type="submit" form="form-bank-transfer" data-toggle="tooltip" title="<?php echo $button_save; ?>" class="btn btn-primary"><i class="fa fa-save"></i></button>
        <a href="<?php echo $cancel; ?>" data-toggle="tooltip" title="<?php echo $button_cancel; ?>" class="btn btn-default"><i class="fa fa-reply"></i></a></div>
and

Code: Select all

 <div class="panel-body">
        <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form-bank-transfer" class="form-horizontal">
          <?php foreach ($languages as $language) { ?>
          <div class="form-group required">

User avatar
Active Member

Posts

Joined
Sun Oct 09, 2011 3:30 pm

Post by cyclops12 » Wed Oct 02, 2019 2:35 pm

Yes they all need to be changed to the new name.

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by burley » Wed Oct 02, 2019 8:48 pm

okay, so how do I have to rename this?

Can I just rename form-bank-transfer to form-payment60daynet ?

User avatar
Active Member

Posts

Joined
Sun Oct 09, 2011 3:30 pm

Post by by mona » Wed Oct 02, 2019 8:52 pm

in both places

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by burley » Wed Oct 02, 2019 11:52 pm

Also updated, but still unable to edit the module once installed and no errors are listed in the log. It just gives me a blank screen (500 error)..

User avatar
Active Member

Posts

Joined
Sun Oct 09, 2011 3:30 pm

Post by cyclops12 » Thu Oct 03, 2019 1:14 am

You still have a major problem as php variables cannot start with numbers so 60daynet will have to be changed
Sorry didnt think of that before

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am
Who is online

Users browsing this forum: No registered users and 36 guests