Book Image

PrestaShop Module Development

By : Fabien Serny
Book Image

PrestaShop Module Development

By: Fabien Serny

Overview of this book

Table of Contents (19 chapters)
PrestaShop Module Development
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a payment module


Just like a conventional module, we will first create the directory and the main class of the module. We will name our new module mymodpayment. So, create a mymodpayment directory in the modules directory of PrestaShop, then create a PHP file with the same name in your new directory.

In this file (mymodpayment.php), create the class and code a constructor based on the same model as the mymodcomment module with one difference; this time, the module's main class won't extend Module, but it will extend PaymentModule:

<?php
class MyModPayment extends PaymentModule
{
  public function __construct()
  {
    $this->name = 'mymodpayment';
    $this->tab = 'payments_gateways';
    $this->version = '0.1';
    $this->author = 'Fabien Serny';
    $this->bootstrap = true;
    parent::__construct();
    $this->displayName = $this->l('MyMod payment');
    $this->description = $this->l('A simple payment module');
  }
}

Note

The PaymentModule class is an...