Jump to content

need help with duplicating multiple bankwire module


Recommended Posts

hi so far i have researched and found that to do that,

 

you have to copy the bankwire module and rename it,

 

rename the bankwire.php file

 

and every "bankwire" word in that php file.

 

Other than that, is there other things i have to look out for?

Link to comment
Share on other sites

essentially you are correct. most people create a copy of the module, and rename bankwire to bankwire2. It is not 'every' instance of bankwire, only references to class names, template files, variables, config names etc...

 

So main things to change

1) Module folder name

2) Module class name ( ie... class BankWire2 extends PaymentModule )

3) module name (ie.. $this->name = 'bankwire2'; )

4) config parameter names, there will be a lot of references to these..... $config = Configuration::getMultiple(array('BANK_WIRE_DETAILS2', 'BANK_WIRE_OWNER2', 'BANK_WIRE_ADDRESS2'));

5) $this->_html .= '<img src="../modules/bankwire2/bankwire.jpg"

 

That should get you started and give you an idea of what types of things need to be changed.

 

take a shot at doing it. When you are done, install the module and test it. If it does not work, post the errors and attach your code, and you will likely get assistance.

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

hi thanks for the help..

 

after i have done the above, when i type in "bankwire" to search for the module in back office, i only see 1 instance of bankwire.

 

if i have done it correctly i should see "bankwire" and "bankwire2" right?

Link to comment
Share on other sites

I installed the module on v1.5.4 and I see 2 "Bank Wire" modules. One more thing you could change is the displayName.

$this->displayName = $this->l('Bank Wire 2');

 

This is used in the back office module list, but also as the payment method on invoices, order details etc... so make it something meaningful

 

Also, I noticed these problems

1) Not using the same configuration variable names. You added 22 to these

   	 $config = Configuration::getMultiple(array('BANK_WIRE_DETAILS22', 'BANK_WIRE_OWNER22', 'BANK_WIRE_ADDRESS22'));

but only 2 to these, as well as other places in the code

'{bankwire_owner}' => Configuration::get('BANK_WIRE_OWNER2'),
'{bankwire_details}' => nl2br(Configuration::get('BANK_WIRE_DETAILS2')),
'{bankwire_address}' => nl2br(Configuration::get('BANK_WIRE_ADDRESS2'))

 

2) missed the image file location

<img src="../modules/bankwire/bankwire.jpg

 

3) in payment.php, you have bankwire. This should only matter in PS v1.4

Tools::redirect(Context::getContext()->link->getModuleLink('bankwire', 'payment'));

 

4) in validation.php, you should change references to bankwire2

include(dirname(__FILE__).'/bankwire.php');
$bankwire = new BankWire();
if ($cart->id_customer == 0 OR $cart->id_address_delivery == 0 OR $cart->id_address_invoice == 0 OR !$bankwire->active)
if ($module['name'] == 'bankwire')

 

5) in the tpl files under the view folder, lots of references to bankwire

 

6) the payment and validation controllers under the controllers\front folder.

BankwirePaymentModuleFrontController should be Bankwire2PaymentModuleFrontController

BankwireValidationModuleFrontController should be Bankwire2ValidationModuleFrontController

 

7) in validation.php under the controllers\front folder, fix references to bankwire and config etc...

if ($module['name'] == 'bankwire')
      	 '{bankwire_owner}' => Configuration::get('BANK_WIRE_OWNER'),
           '{bankwire_details}' => nl2br(Configuration::get('BANK_WIRE_DETAILS')),
           '{bankwire_address}' => nl2br(Configuration::get('BANK_WIRE_ADDRESS'))

  • Like 1
Link to comment
Share on other sites

Thanks bellini13 for the detailed guide..

 

I have followed it but still have some issue with it...perhaps there is something i missed...

 

but for now i will edit the content of payment_return.tpl file to reflect more bankwire choices...in this way customers will only need to click on one bankwire module and be shown the way to wire to different banks.

 

thanks again!

Link to comment
Share on other sites

  • 1 month later...

Hi all, I started to created custom payment plugin from cheque plugin to "Pay by omni" method, But when i click "confirm order" it shows some errors on page of validation url.

 

Errors are:

[PrestaShopException]

 

Can't load Order state status

at line 145 in file classes/PaymentModule.php

 

139. if (Configuration::get('PS_TAX_ADDRESS_TYPE') == 'id_address_delivery')

140. $context_country = $this->context->country;

141.

142. $order_status = new OrderState((int)$id_order_state, (int)$this->context->language->id);

143. if (!Validate::isLoadedObject($order_status))

144. throw new PrestaShopException('Can\'t load Order state status');

145.

146. if (!$this->active)

147. die(Tools::displayError());

148. // Does order already exists ?

149. if (Validate::isLoadedObject($this->context->cart) && $this->context->cart->OrderExists() == false)

  • PaymentModuleCore->validateOrder - [line 64 - modules/omni/controllers/front/validation.php] - [9 Arguments]
     
    58. $mailVars = array(
    59. '{omni_name}' => Configuration::get('OMNI_NAME'),
    60. '{omni_address}' => Configuration::get('OMNI_ADDRESS'),
    61. '{omni_address_html}' => str_replace("\n", '<br />', Configuration::get('OMNI_ADDRESS')));
    62.
    63. $this->module->validateOrder((int)$cart->id, Configuration::get('PS_OS_OMNI'), $total, $this->module->displayName, NULL, $mailVars, (int)$currency->id, false, $customer->secure_key);
    64. Tools::redirect('index.php?controller=order-confirmation&id_cart='.(int)$cart->id.'&id_module='.(int)$this->module->id.'&id_order='.$this->module->currentOrder.'&key='.$customer->secure_key);
    65. }
    66. }
  • OmniValidationModuleFrontController->postProcess - [line 158 - classes/controller/Controller.php] - [0 Argument]
     
    152. // setMedia MUST be called before postProcess
    153. if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className)))
    154. $this->setMedia();
    155.
    156. // postProcess handles ajaxProcess
    157. $this->postProcess();
    158.
    159. if (!empty($this->redirect_after))
    160. $this->redirect();
    161.
    162. if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className)))
  • ControllerCore->run - [line 349 - classes/Dispatcher.php] - [0 Argument]
     
    343. // Execute hook dispatcher
    344. if (isset($params_hook_action_dispatcher))
    345. Hook::exec('actionDispatcher', $params_hook_action_dispatcher);
    346.
    347. // Running controller
    348. $controller->run();
    349. }
    350. catch (PrestaShopException $e)
    351. {
    352. $e->displayMessage();
    353. }
  • DispatcherCore->dispatch - [line 28 - index.php] - [0 Argument]
     
    22. * @license http://opensource.or...ses/osl-3.0.php Open Software License (OSL 3.0)
    23. * International Registered Trademark & Property of PrestaShop SA
    24. */
    25.
    26. require(dirname(__FILE__).'/config/config.inc.php');
    27. Dispatcher::getInstance()->dispatch();
    28.

please guide me. I am new to web development field.

 

You can download model from this link. http://dhondo.com/kakar/omni.zip

 

 

I also use bankwire2 plugin for this task but it show previously install bankwire module data. So, Please every body help me. Bcz I am stucked.

 

 

You can also visit my sample shop at http://shop.dhondo.com

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

  • 2 months later...

Hi, i need some review on my customized module... I want to use a westernunion as a duplication of bankwire module...I have changed all bankwire fies and names to westernunion and i havre configured and enabled it to work everything is fine until i click 'place my order' than when it comes to validation process i receive an error like>>>>> Oops, something went wrong.Try to refresh this page or feel free to contact us if the problem persists.

 

You can try to place an order throuh a normal process at >>

 

https://institutiamerikanisuksesit.com/shop/

 

and attached you"ll find the copy of my customized module

 

 

Thanks in advance

 

thats correct, you should see both modules listed, unless of course you have a filter enabled.

 

zip your module and post it here for review

 

Hi, i need some review on my customized module... I want to use a westernunion as a duplication of bankwire module...I have changed all bankwire fies and names to westernunion and i havre configured and enabled it to work everything is fine until i click 'place my order' than when it comes to validation process i receive an error like>>>>> Oops, something went wrong.Try to refresh this page or feel free to contact us if the problem persists.

 

You can try to place an order throuh a normal process at >>

 

https://institutiamerikanisuksesit.com/shop/

 

and attached you"ll find the copy of my customized module

 

 

Thanks in advance

westernunion.zip

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...