Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

German sepabanktransfer Add-ons


Joahim2509

Recommended Posts

Hallo. I am trying to configure the sepabanktransfer Add-on from http://addons.oscommerce.com/info/7597. This is a module users who want to offer SEPA-Bank transfer as a payment method. I made all steps from the atachment file but when I whant to activate it I get an error regarding database :

1062 - Duplicate entry '' for key 'PRIMARY'

insert into sepabanktransfer_bic (country, name, addresse, ort, bic, gueltig_ab) values ('AUSTRIA|ALIZEE BANK AG|RENNGASSE 6-8|VIENNA|ALBWATWWXXX|2010-11-01|\r', '', '', '', '', '')

 

I cleared this table (sepabanktransfer_bic) but I get this error anyway. Plese giv me some advice to solve this error.

 

Thank you

Link to comment
Share on other sites

Something seems to have gone very wrong with the code to insert data into the table. The SQL command should have been

insert into sepabanktransfer_bic (country, name, addresse, ort, bic, gueltig_ab) 
  values ('AUSTRIA','ALIZEE BANK AG','RENNGASSE 6-8','VIENNA','ALBWATWWXXX','2010-11-01')

Did you do this manually, or is there a script to be run to fill the table? Did you modify it in any way? What is the definition of the table sepabanktransfer_bic?

Link to comment
Share on other sites

Something seems to have gone very wrong with the code to insert data into the table. The SQL command should have been

insert into sepabanktransfer_bic (country, name, addresse, ort, bic, gueltig_ab) 
  values ('AUSTRIA','ALIZEE BANK AG','RENNGASSE 6-8','VIENNA','ALBWATWWXXX','2010-11-01')

Did you do this manually, or is there a script to be run to fill the table? Did you modify it in any way? What is the definition of the table sepabanktransfer_bic?

Thenks for your answer. Ther is a ascript that make this all. I have no made any changes. This table store all data about banks in divers countrys with international conds for bank transfers

Link to comment
Share on other sites

What PHP version are you running with? The split() command is deprecated as of 5.3, and may have even been dropped in a later version. Anyway, I think the problem is around line 415 of catalog/includes/modules/payment/sepabanktransfer.php:

list($country,$name,$addresse,$ort,$bic,$gueltig_ab,$gueltig_bis) = split('\|',$line);

It's failing to split for some reason. Try each of the following replacements for this line:

list($country,$name,$addresse,$ort,$bic,$gueltig_ab,$gueltig_bis) = split("|",$line);
list($country,$name,$addresse,$ort,$bic,$gueltig_ab,$gueltig_bis) = explode("|",$line);
list($country,$name,$addresse,$ort,$bic,$gueltig_ab,$gueltig_bis) = preg_split("/\|/",$line);

and see if any of them fixes the problem. In the preg_split(), you may need to remove the \.

 

With luck, the \r at the end of the line will be discarded from the list(). Check the gueltig_bis database field to make sure it doesn't have \r in it.

 

It's possible that you will run into other problems with old PHP code in this add-on being run on modern PHP versions.

Edited by MrPhil
Link to comment
Share on other sites

What PHP version are you running with? The split() command is deprecated as of 5.3, and may have even been dropped in a later version. Anyway, I think the problem is around line 415 of catalog/includes/modules/payment/sepabanktransfer.php:

list($country,$name,$addresse,$ort,$bic,$gueltig_ab,$gueltig_bis) = split('\|',$line);

It's failing to split for some reason. Try each of the following replacements for this line:

list($country,$name,$addresse,$ort,$bic,$gueltig_ab,$gueltig_bis) = split("|",$line);
list($country,$name,$addresse,$ort,$bic,$gueltig_ab,$gueltig_bis) = explode("|",$line);
list($country,$name,$addresse,$ort,$bic,$gueltig_ab,$gueltig_bis) = preg_split("/\|/",$line);

and see if any of them fixes the problem. In the preg_split(), you may need to remove the \.

 

With luck, the \r at the end of the line will be discarded from the list(). Check the gueltig_bis database field to make sure it doesn't have \r in it.

 

It's possible that you will run into other problems with old PHP code in this add-on being run on modern PHP versions.

Now after that I get more errors :

 

Warning: mysql_list_fields() [function.mysql-list-fields]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /srv/disk12/1131496/www/opall.famelymoments.ro/includes/modules/payment/sepabanktransfer.php on line 463

 

Warning: mysql_list_fields() [function.mysql-list-fields]: A link to the server could not be established in /srv/disk12/1131496/www/opall.famelymoments.ro/includes/modules/payment/sepabanktransfer.php on line 463

 

Warning: mysql_num_fields() expects parameter 1 to be resource, boolean given in /srv/disk12/1131496/www/opall.famelymoments.ro/includes/modules/payment/sepabanktransfer.php on line 464

1060 - Duplicate column name 'customers_sepabanktransfer_owner'

 

ALTER TABLE customers ADD `customers_sepabanktransfer_owner` VARCHAR( 64 ) DEFAULT NULL AFTER `customers_newsletter`, ADD `customers_sepabanktransfer_iban` VARCHAR( 40 ) DEFAULT NULL AFTER `customers_sepabanktransfer_owner`, ADD `customers_sepabanktransfer_swift` VARCHAR( 16 ) DEFAULT NULL AFTER `customers_sepabanktransfer_iban`, ADD `customers_sepabanktransfer_name` VARCHAR( 64 ) DEFAULT NULL AFTER `customers_sepabanktransfer_swift`, ADD `customers_sepabanktransfer_swift_country_id` INT(11) UNSIGNED NOT NULL after `customers_sepabanktransfer_name`

Link to comment
Share on other sites

So you changed the one line, and got past the original error? If you only changed that one line, your new problems are unrelated. Possibly your MySQL server has crashed, although if it has, I would expect an error at the connection. It's unlikely that the host just updated PHP this weekend and omitted MySQL support (they should still support MySQLi), but in that case you should be getting an error at mysql_connect() (if it's even called).
 
Whether or not your MySQL server has been updated (or crashed), I see there are three mysql_* calls in the sepabanktransfer code. If you are running an up-to-date osC installation (2.3.4 and up), you should not be mixing mysql_ calls with the mysqli_ calls used elsewhere. It sounds like the add-on needs updating.
 
In catalog/includes/modules/payment/sepabanktransfer.php,
 

$fields = mysql_list_fields(DB_DATABASE, TABLE_CUSTOMERS);

supposedly can be replaced by

$fields = tep_db_query("SHOW COLUMNS FROM " . $TABLE_CUSTOMERS);

 
according to php.net's online function list, although I have not tried it myself, and it's quite possible you will have to read through what the query returns and get the list of fields with a few extra steps.
 
Similar fixes should be possible for the mysql_num_fields() and mysql_field_name() calls. If this add-on's author is actively maintaining it, they should update it with these fixes. If not, could someone take on this task?

Link to comment
Share on other sites

Now I get other error but in frontend "Call to undefined function tep_get_country_swift_list() in /srv/disk12/1131496/www/sitename/includes/modules/payment/sepabanktransfer.php on line 172"

This error I resolved but I get other one Warning: mysql_list_fields() [function.mysql-list-fields]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /srv/disk12/1131496/www/opall.famelymoments.ro/includes/modules/payment/sepabanktransfer.php on line 450

 

Warning: mysql_list_fields() [function.mysql-list-fields]: A link to the server could not be established in /srv/disk12/1131496/www/opall.famelymoments.ro/includes/modules/payment/sepabanktransfer.php on line 450

 

Warning: mysql_num_fields() expects parameter 1 to be resource, boolean given in /srv/disk12/1131496/www/opall.famelymoments.ro/includes/modules/payment/sepabanktransfer.php on line 451

 

Warning: Cannot modify header information - headers already sent by (output started at /srv/disk12/1131496/www/opall.famelymoments.ro/includes/modules/payment/sepabanktransfer.php:1) in /srv/disk12/1131496/www/opall.famelymoments.ro/admin/includes/functions/general.php on line 36

Link to comment
Share on other sites

If the rest of your store is using the MySQLi library, you should replace the mysql_* calls with mysqli_* or tep_* calls. I can't guarantee that you can mix mysql_* calls and mysqli_* calls in the same application.

 

If this add-on is no longer being maintained by its author (have you tried contacting them?), I would be willing to help come up with replacement code here for those three mysql_* statements.

Link to comment
Share on other sites

If the rest of your store is using the MySQLi library, you should replace the mysql_* calls with mysqli_* or tep_* calls. I can't guarantee that you can mix mysql_* calls and mysqli_* calls in the same application.

 

If this add-on is no longer being maintained by its author (have you tried contacting them?), I would be willing to help come up with replacement code here for those three mysql_* statements.

Thank you for your answer. Unfortunately author dont respond to my questions, I think he dont suppor any more this Add-on. If you dont mind and can help me, I will be very thankful. This is the cod from this lines:

must_alter_table = true;
      $fields = mysql_list_fields(DB_DATABASE, TABLE_CUSTOMERS);
      $columns = mysql_num_fields($fields);
      for ($i = 0; $i < $columns; $i++) {
        $field = mysql_field_name($fields, $i);
        if ($field == 'customers_sepabanktransfer_iban') {
          $must_alter_table = false;
        }
      }
Link to comment
Share on other sites

OK, you have the proper section of code with the three mysql_* calls we need to replace. If I understand what the code is trying to do, it's setting $must_alter_table to TRUE unless it finds a field named "customers_sepabanktransfer_iban" already in the table.

 

Try the following:

$must_alter_table = true;
$fields = tep_db_query("SHOW COLUMNS FROM " . TABLE_CUSTOMERS);
$columns = tep_db_num_rows($fields);
for ($i = 0; $i < $columns; $i++) {
  $field = tep_db_fetch_array($fields);
  if ($field[Field] == 'customers_sepabanktransfer_iban') {
    $must_alter_table = false;
    break;
  }
}

1) I have not actually tried this. If it doesn't work, I'll have to build a test case and try running it.

2) The code was (and still is) not very robust. There is no checking for a failed query, etc.

Link to comment
Share on other sites

Thanks this lines appear to be the right one. The Warnings disappeared but the scipt dont do what its need to do :). Probably it not make a selection  from database for front end, the dropdown list that need to  be populated from from DB are empty in front-end. May advice me where I need to check and how if it makes an selection from DB. 

I think in this code go the proces but i am not sure:

else {
          $selection = array('id' => $this->code,
                         'module' => $this->title,
                         'fields' => array(array('title' => MODULE_PAYMENT_SEPABT_TEXT_NOTE,
                                                 'field' => MODULE_PAYMENT_SEPABT_TEXT_BANK_INFO),
                                           array('title' => MODULE_PAYMENT_SEPABT_TEXT_BANK_OWNER,
                                                 'field' => tep_draw_input_field('sepabanktransfer_owner', $order->billing['firstname'] . ' ' . $order->billing['lastname'])),
                                           array('title' => MODULE_PAYMENT_SEPABT_TEXT_BANK_COUNTRY,
                                                 'field' => tep_get_country_swift_list('sepabanktransfer_swift_id', $aEbtVarSet["ebt_swift_id"])),
                                           array('title' => MODULE_PAYMENT_SEPABT_TEXT_BANK_SWIFT,
                                                 'field' => tep_draw_input_field('sepabanktransfer_swift', $aEbtVarSet["ebt_swift"], 'size="36" maxlength="36"')),
                                           array('title' => MODULE_PAYMENT_SEPABT_TEXT_BANK_IBAN,
                                                 'field' => tep_draw_input_field('sepabanktransfer_iban', $aEbtVarSet["ebt_iban"], 'size="36" maxlength="36"')),
                                           array('title' => MODULE_PAYMENT_SEPABT_TEXT_BANK_NAME,
                                                 //'field' => tep_draw_input_field('sepabanktransfer_name',$aEbtVarSet["ebt_name"]))
                                                 'field' => $aEbtVarSet["bt_bankname"] . tep_draw_hidden_field('customers_sepabanktransfer_name'))
                               
                                                 
                                           ));
        }

Thenk you for your help

 

image of fron-end https://goo.gl/photos/jskDCBYYp7EQzYJ3A

Link to comment
Share on other sites

I'm not familiar with this add-on, so I'm not sure I can help any further. However, I would go into phpMyAdmin and see if the "customers" table has successfully added a new field "customers_sepabanktransfer_iban". If it hasn't, something has gone wrong very early in the process. If it has been added, at least the part of the code I just gave you the update for is now working. Beyond that, someone familiar with payment systems and writing code for them might be better for you. If you can narrow it down to a specific error in the PHP code, maybe I can help with why it's not doing what it's supposed to be doing.

 

Also, there is the possibility that SEPA has been changed since this add-on was written, and no longer works with this old code. Perhaps they would know of a source for up-to-date code?

Link to comment
Share on other sites

  • 2 weeks later...

What PHP version are you running with? The split() command is deprecated as of 5.3, and may have even been dropped in a later version. Anyway, I think the problem is around line 415 of catalog/includes/modules/payment/sepabanktransfer.php:

list($country,$name,$addresse,$ort,$bic,$gueltig_ab,$gueltig_bis) = split('\|',$line);

It's failing to split for some reason. Try each of the following replacements for this line:

list($country,$name,$addresse,$ort,$bic,$gueltig_ab,$gueltig_bis) = split("|",$line);
list($country,$name,$addresse,$ort,$bic,$gueltig_ab,$gueltig_bis) = explode("|",$line);
list($country,$name,$addresse,$ort,$bic,$gueltig_ab,$gueltig_bis) = preg_split("/\|/",$line);

and see if any of them fixes the problem. In the preg_split(), you may need to remove the \.

 

With luck, the \r at the end of the line will be discarded from the list(). Check the gueltig_bis database field to make sure it doesn't have \r in it.

 

It's possible that you will run into other problems with old PHP code in this add-on being run on modern PHP versions.

Hi, can you please help me with this function

split("[:,]" , $dp_cost)

to transfor it to EXPLODE function. I try but something go worig the result is not correct.

Link to comment
Share on other sites

  • 2 weeks later...

Hi. I need some help. When user insert the Swift code it obtains erorr "Diese SWIFT-Nummer in lokaler DB nicht gefunden." untill it not write "XXX" after the swift code. For example the swift code is "PBNKDEFF" and user must to write "PBNKDEFFXXX". How to fix that?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...