Jump to content

Cloning Bankwire module - prestashop v1.6.1.17


johnchristy

Recommended Posts

Hi friends,

I'm following these 2 guides to clone bankwire module -

http://rocinantesoftware.blogspot.com/2015/11/how-to-make-copy-of-prestashop-16-bank_2.html

It's working but the last payment return screen is throwing 500 errors. So I enabled debug mode and this is what i got : https://pastebin.com/TKUgFsTb

Screenshot - https://www.dropbox.com/s/4ple016u6r3h2q1/2019-02-09_13-49-48.png?dl=0

Then I managed to fix the validateorder error which is

59. 			'{banktransfer_owner}' => Configuration::get('BANK_WIRE_OWNER'),
60. 			'{banktransfer_details}' => nl2br(Configuration::get('BANK_WIRE_DETAILS')),
61. 			'{banktransfer_address}' => nl2br(Configuration::get('BANK_WIRE_ADDRESS'))
62. 		);
63. 
64. 		$this->module->validateOrder($cart->id, Configuration::get('PS_OS_banktransfer'), $total, $this->module->displayName, NULL, $mailVars, (int)$currency->id, false, $customer->secure_key);
65. 		Tools::redirect('index.php?controller=order-confirmation&id_cart='.$cart->id.'&id_module='.$this->module->id.'&id_order='.$this->module->currentOrder.'&key='.$customer->secure_key);
66. 	}
67. }

 

I changed PS_OS_banktransfer to PS_OS_BANKTRANSFER. then I didnt get any errors  but upon completion it's not showing the full contents of my payment_return.tpl

It's only showing this (screenshot) - https://www.dropbox.com/s/rkrszoie7eifocs/2019-02-09_13-43-47.png?dl=0

Any idea how can I clone this module without any errors?

Thanks

Link to comment
Share on other sites

  • 5 months later...
  • 4 months later...
  • 5 months later...

I've managed to successfully create a clone of the ps_wirepayment module for Prestashop 1.7 (running 1.7.6.5) using Ed Eichman's blog post noted earlier in this thread.  I've tested it and it seems to work fine; I was able to use it to display different bank account info depending on the client's chosen currency.

To install, first use phpmyadmin to edit the psbb_configuration table:

– Add PS_OS_BANKWIRE2 (I used value 99) to the configuration table, imitating PS_OS_BANKWIRE

– Also add values to the tables order_state and order_state_lang imitating bankwire, using the same id_order_state value as PS_OS_BANKWIRE2 (99 in my case).

– Install the attached module .zip using the BO modules installer. Configure and you'll find it under the name "Wire Transfer" in the Modules listing and Payment Preferences menu.

With much added effort, I was able to add the translations for this module to the BO; you'll find them under "Installed Modules Translations" –> "Wire Transfer".  *BUT* I could not figure out how to add the title of the payment method (what is shown to the customer at checkout) to the translation database, so you'll have to modify it by hand by editing ps_wiretransfer.php, line 197. For example, I wanted mine to state the currency of the bank account used:

     ->setCallToActionText($this->trans('Bank Transfer in EUR', array(), 'Modules.Wiretransfer.Shop'))

If anyone can make this text translatable, please let us know!

Enjoy!

 

ps_wiretransfer.zip

Edited by shapwill
Improved the module (added translation support) since my original post. (see edit history)
  • Thanks 3
Link to comment
Share on other sites

  • 1 month later...

Big big big thanks to shapwill ! Thanks for sharing the clone it works perfectly except for translating the title i didn't find any solution too, but it actually works and i duplicated the module like 5 times because i need different bank accounts for each carrier.

Thanks again big up !

Link to comment
Share on other sites

  • 1 year later...
On 5/13/2020 at 9:43 PM, shapwill said:

With much added effort, I was able to add the translations for this module to the BO; you'll find them under "Installed Modules Translations" –> "Wire Transfer".  *BUT* I could not figure out how to add the title of the payment method (what is shown to the customer at checkout) to the translation database, so you'll have to modify it by hand by editing ps_wiretransfer.php, line 197. For example, I wanted mine to state the currency of the bank account used:

     ->setCallToActionText($this->trans('Bank Transfer in EUR', array(), 'Modules.Wiretransfer.Shop'))

If anyone can make this text translatable, please let us know!

 

 

->setCallToActionText($this->l('Bank transfer in EUR'))

seems to do the trick

Link to comment
Share on other sites

  • 6 months later...
  • 3 months later...

As for translations it depends on the ps version. Since 1.7.6 there is new version of translations using app/resources/translations. However you can modify it by copying translations from there and pasting them inside cloned module. Remember that every translation markup has to be changed inside module.

example:

$this->displayName = $this->trans('Wire payment', [], 'Modules.Wirepayment.Admin');
$this->displayName = $this->trans('Wire payment Euro', [], 'Modules.Wirepaymenteuro.Admin');

If you want to clone module here are steps:

  1. Copy existing wirepayment module
  2. rename it to wirepayment{currency you want}
  3. open every PHP, tpl file and use "find and replace" and replace ps_wirepayment with ps_wirepayment{currency you want}. If you want to do it manually remember to also change class names.
  4. Change configuration of the module with "find and replace" and replace all details BANK_WIRE_DETAILS, BANK_WIRE_OWNER, BANK_WIRE_ADDRESS, BANK_WIRE_RESERVATION_DAYS, BANK_WIRE_CUSTOM_TEXT, BANK_WIRE_PAYMENT and add to the end "_{currency you want}". This way you create new rows in database and you are able to store new bank details.
    $config = Configuration::getMultiple(['BANK_WIRE_DETAILS_EURO', 'BANK_WIRE_OWNER_EURO', 'BANK_WIRE_ADDRESS_EURO', 'BANK_WIRE_RESERVATION_DAYS_EURO']);
  5. If you want to use default translations of the wire payment module you can skip step next steps.
  6. open every PHP, tpl file and use "find and replace" to replace Modules.Wirepayment.Admin and Modules.Wirepayment.Shop with Modules.Wirepayment{currency you want}.Admin and Modules.Wirepayment{currency you want}.Shop so you can use different translations for this specific module.
  7. open app\Resources\translations\en-US (or any other language you want to copy) and copy translations files ModulesWirepaymentAdmin.en-US and ModulesWirepaymentShop.en-US. Paste these files into your cloned module modules/translations/en-US (or any other language you want to copy) and replace names of the files to match the step 5 Modules.Wirepayment{currency you want}. Example: ModulesWirepaymentAdmin.en-US should be replaced with currency name like this ModulesWirepaymenteuroAdmin.en-US. Remember to allways use lowercase for these changes as prestashop is sensitive to that.
  8. Open copied translations files and replace path of "original="modules/ps_wirepayment" to "original="modules/ps_wirepaymenteuro" or original="modules/ps_wirepayment{currency you want}

As for troubleshooting, first check if you replaced path "modules/ps_wirepayment" inside tpl files and translation files. Allways use lowercase inside filenames! With find and replace you might need to change filename inside module\views\templates\hook\ps_wirepayment_intro 

Hope that sums up, how to clone bankwire payment module for PS 1.7.6 and up. For previous versions the main difference might be translations.

 

ps_wirepaymenteuro.zip

Edited by WisQQ (see edit history)
Link to comment
Share on other sites

  • 3 months later...

Hi,

by using this cloned version, is it safe proof for future prestashop updates (i show it needs some DB changes), or it will "reset" and need to install again after an update?

I want to use it, to try if possible to add an extra (stadard) fee, if bank wire is the payment option. Any idea?

 

Thanks!

Link to comment
Share on other sites

58 minutes ago, orotoi said:

by using this cloned version, is it safe proof for future prestashop updates (i show it needs some DB changes), or it will "reset" and need to install again after an update?

The risk is always there. Solution is to download the modiefied files.

Edited by Nickz (see edit history)
Link to comment
Share on other sites

5 godzin temu, orotoi napisał:

Hi,

by using this cloned version, is it safe proof for future prestashop updates (i show it needs some DB changes), or it will "reset" and need to install again after an update?

I want to use it, to try if possible to add an extra (stadard) fee, if bank wire is the payment option. Any idea?

 

Thanks!

The module is plain copy of widerpayment module with changed name so it can be shown as different option. If there will be update of original module, you can copy it again and do exact same changes and it should work.

As for the Fee it can be done, but it's even less future proof as you need to modify even more lines of code.

The database changes are just new fields for new bank account details. If you dont change these names, it will display already existing data from wirepayment module which was saved before. You can find them inside configuration table.

Edited by WisQQ (see edit history)
  • Like 1
Link to comment
Share on other sites

Dnia 6.02.2023 o 1:04 PM, orotoi napisał:

Cheers!

Do you have any suggestions on how to add the fee to an option?

I think I ll have to do it in the [payment].php and on view/front .tpl

 

Yes you will have to modify ps_wirepayment.php file. But first you have to find how exacly other fees are added for example shipping costs and then add them in similar hooks. 
Then to display the fee you will have to modify templates from module, email and order history. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...