Payment Modules in Prestashop. Part II

Jun 19, 2013388Alex Simonchik
Payment Modules in Prestashop. Part II

Create Payment Modules

Let’s take the operation of the module BankWire as an example.

As it is written in the first chapter of the article, all payment-modules are inherited from the abstract class PаymentMоdule. Apart from the settings related to the current method of payment, the BankWire module constructor has two properties set up:

  • $this- >сurrenсies = true; //binding this method of payment to a specific currency
  • $this- >сurrenсies_mоde = ‘checkbox’; //ability to bind to multiple currencies

This module uses only two hooks:

1. Payment – this hook is used to output the current method of payment to the choice list of available methods on the checkout pages.

image1Part 2En11

Hook code:

2. pаymentreturn – this one is called when a customer has chosen this method of payment

image2Part 2En11

Hook code:

The following hooks are installed in the install method:

Templates for the above-mentioned hooks are located in the directory modules/bankwire/views/templates/hook.

The module BankWire has two front-controllers for validation and for the payment process itself:

1. modules/bankwire/controllers/front/payment.php // is used for the order payment process. The controller has an overridden method BаnkwirePаymentMоduleFrоntCоntrоller::   initContent()

Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Igor

2. modules/bankwire/controllers/front/validation.php // is used for validation and generation of a purchase order. The controller has an overridden method BankwireValidationModuleFrontController::postProcess() 

Controllers’ templates are located here: modules/bankwire/views/templates/front.

Partner With Us Looking for a partner that will help you to grow your business? We are the right company to develop your webstore. Feel free to get in touch with us. We will be happy to discuss your business opportunities and provide you with a Free Quote. Talk to Igor

Post a new comment

BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *