Other

PrestaShop Book for Module Development 1.6 / 1.7

Thanks to its experience as PrestaShop core developer, Fabien Serny former head of modules at PrestaShop and nowadays founder of Froggy Commerce, presents a developement guide of good practices to create your own modules for PrestaShop.

The development of PrestaShop modules

The modules are the root of the eco system of PrestaShop. They are essential for adding functionalities on a PrestaShop e-commerce website. This book was born of a desire to help developers understand how works the modular part of PrestaShop in order to acquire the best practices to optimize and secure PrestaShop modules.

With a foreword written by Bruno Lévêque, PrestaShop founder, this book is a reference for the development of PrestaShop modules..

The author, Fabien Serny , did everything to facilitate the approach of the development of PrestaShop modules, you will find below all the information about the book.

Outline of the PrestaShop Module Development book

  • Preface

    In the preface, you will read a summary of the book to learn what is possible to do with modules in PrestaShop. You will also find a quick recall of PrestaShop basis needed to understand this book correctly (architecture, database classes, objects models, controllers, overrides and smarty).

  • Chapter 1: Creating a new module

    In this chapter, we will code together a small module example. You will also learn how to build a quick configuration form. List of topics that will be covered in the chapter:

    • Create the bootstrap of an installable module
    • Add a configuration form to the module using Smarty templates
    • Register the module configuration in database
  • Chapter 2: Hooks

    In this section, you will read about the hooks in PrestaShop, how they work and how you can use them. You will also find a list of all hooks present in PrestaShop. List of topics that will be covered in the chapter:

    • Register a module on a hook
    • Use database class
    • How hooks are triggered
    • How to add new hooks
    • How to use dynamic hooks
  • Chapter 3: Using context and its methods

    You will have a presentation of all the variables and methods availables when you develop a module. List of topics that will be covered in the chapter:

    • Use the method l and make your module multi-lang compliant
    • Use the methods addCSS and addJS to improve the ergonomy on the front office
  • Chapter 4: Building module updates

    In this chapter, you will learn how to manage specific database tables for your modules (creation and update). List of topics that will be covered in the chapter:

    • Create a SQL table when the module is installed
    • Delete a SQL table when the module is uninstalled
    • Alter existing SQL table when the module is updated
  • Chapter 5: Front controllers, Object Models and Overrides

    We will see how we can add controllers and routes with your module, which will permit to construct a well organized application for PrestaShop. List of topics that will be covered in the chapter:

    • Use Front controllers to create new pages
    • Add overrides on module installation
    • Make your code cleaner using ObjectModel, hook Controllers and HelperForm
  • Chapter 6: Admin Controllers and Hooks

    In this section, we will see how to add a controller in the back office, register on admin hooks and use admin helpers to display list and form. List of topics that will be covered in the chapter:

    • Add Admin Controllers
    • Use Back Office hooks
  • Chapter 7: Carrier modules

    In this chapter, you will learn the specificity of carrier modules. We will also look on advanced features such as delivery points. List of topics that will be covered in the chapter:

    • Create a very simple carrier module
    • Use the object Carrier
    • Add options such as relay point feature
  • Chapter 8: payment modules

    In this chapter, you will learn the specificity of payment modules. You will also learn about the creation of new order states. List of topics that will be covered in the chapter:

    • Create a basic payment module
    • Use the function validateOrder to transform a cart into an order
    • Create new order states
    • Send an e-mail
    • Connect to a third-party API
  • Chapter 9: Multistore

    In this section, we will see how we can make our module multistore ready. You will also see that, for very simple modules, you do not need to do anything to make them compliant with multistore feature. List of topics that will be covered in the chapter:

    • Enable the multistore feature and create a new shop
    • How to update our module code to make it compliant with this feature
    • How the Configuration class works natively with this feature
  • Chapter 10: Optimizations and Security

    In this section, we will see the best practices concerning security in general in PrestaShop but also some advices to apply in modules configuration and coding. List of topics that will be covered in the chapter:

    • Secure your module against directory listing, direct file access, SQL injection and XSS
    • Search for malicious code in modules
    • Improve the performance of your modules

    Appendix – list of hooks

A word about the author, Fabien Serny

PrestaShop expert and 23Prod founder, Fabien Serny is a former core developer of the PrestaShop solution. His career on an open-source project pushes him to share his knowledge.

This book has been designed to support PrestaShop modules developers in their projects. We hope it will satisfy the expectations and help beginners as well as the more experienced to know all the tips on modules development.

Related resources

Find here the resources associated to the book:

See website
Besoin d'aide ?
Comment puis je vous aider ?
Ce champs ne peux pas être vide