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
About the Author
About the Reviewers


This book covers how to develop different modules for PrestaShop 1.6. It will walk you through the widely used best practices and empower you to use these methods while developing various features in PrestaShop. This book will help you create powerful and scalable modules, thereby improving the performance of your shop.

Throughout the course of this book, you will be introduced to a number of clear, practical examples of PrestaShop concepts (such as hooks) in the form of a tutorial. You will also get acquainted with the best practices of PrestaShop, which will greatly reduce the probability of introducing errors in your future modules.

By the end of this book, you will be accustomed with PrestaShop best practices and the important concepts to make a great module.

What this book covers

Chapter 1, Creating a New Module, covers the first step of module creation. This chapter introduces you to a small module example with a simple configuration form.

Chapter 2, Hooks, presents the concept of hooks in PrestaShop, including how they work and how they can be used to interact with the software. The use of the database class is also covered with practical examples.

Chapter 3, Using Context and its Methods, introduces you to the many methods available in PrestaShop, such as the multilingual function or JS/CSS manager.

Chapter 4, Building Module Updates, introduces you to the native module update system. Some extra functional tips are also revealed.

Chapter 5, Front Controllers, Object Models, and Overrides, presents the main design patterns of PrestaShop and explains how to use them to construct a well-organized application.

Chapter 6, Admin Controllers and Hooks, explains how to create new administration tools, use the helper to build forms or an object list, and how to use the hooks available in the administration panel.

Chapter 7, The Carrier Module, introduces you to the creation of a module carrier. Some advanced features such as delivery point handling are also covered.

Chapter 8, The Payment Module, introduces you to the creation of a payment module. An example of creating a payment API is covered.

Chapter 9, Multistore, covers the main guidelines to make your module compliant with the multistore native PrestaShop feature.

Chapter 10, Security and Performance, explains the best practices to make your module secure and efficient.

Appendix, Native Hooks, gives a description of all the hooks that PrestaShop offers.

What you need for this book

The modules written in these chapters are all based on PrestaShop 1.6, so you will require what's listed on the PrestaShop standard requirements list, which is available at The requirements are as follows:

  • PHP v5.2 or higher

  • MySQL v5.0 or later

  • It would be better if you work with Unix hosting, Apache Web Server 1.3 or later, with at least 64 MB of RAM dedicated to PHP

Who this book is for

This book is intended for web application developers working with PrestaShop who want to increase the efficiency of their shop. It is assumed that you have some experience with PHP and are familiar with coding OOP methods.


In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Open the modules directory in the root of the PrestaShop directory, then create a new directory and name it with the technical name we chose: mymodcomments."

A block of code is set as follows:

class MyModComments extends Module

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "The module is now a working module; you can install it by clicking on the Install button."


Warnings or important notes appear in a box like this.


Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.

Additionally, the code for this book is part of a Git repository, which is available on GitHub at,, and

Downloading the color images of this book

We also provide you a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from:


Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from


Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.


You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.