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

Deleting a table on uninstallation

The uninstall method is pretty much constructed the same way as the install method.

First, create an uninstall.sql file in the install directory of your module in which you will write the following SQL command to drop the mymod_comment table:

DROP TABLE `PREFIX_mymod_comment`;

Next, in mymodcomment.php, write an uninstall method to do the following:

  • Call the uninstall parent method
  • Load the uninstall.sql file
  • Check the return values

We will also delete the configuration values MYMOD_GRADES and MYMOD_COMMENTS. It isn't mandatory but it's cleaner that way.

At the end, you should have something like this:

public function uninstall() { // Call uninstall parent method if (!parent::uninstall()) return false; // Execute module ...

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