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

First step to create a carrier module


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

In this file (mymodcarrier.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 CarrierModule:

<?php

class MyModCarrier extends CarrierModule
{
  public function __construct()
  {
    $this->name = 'mymodcarrier';
    $this->tab = 'shipping_logistics';
    $this->version = '0.1';
    $this->author = 'Fabien Serny';
    $this->bootstrap = true;
    parent::__construct();
    $this->displayName = $this->l('MyMod carrier');
    $this->description = $this->l('A simple carrier module');
  }
}

Note

CarrierModule...