O'Reilly logo

PrestaShop Module Development by Fabien Serny

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4. Building Module Updates

In Chapter 2, Hooks, to create a SQL table, we used phpMyAdmin (any SQL manager tool will do). However, you will agree that it isn't very handy for the merchant who wants to install the module. There are no PrestaShop official methods to create, delete, or update a database table in a module. I will show you the one used in most of the native PrestaShop modules.

In this chapter, we will see how to do the following:

  • Create a SQL table when the module is installed
  • Delete a SQL table when the module is uninstalled
  • Alter the existing SQL table when the module is updated

Creating a database table on module installation

First of all, we will create a directory named install in the module directory. In this directory, create ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required