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

Upgrading your module


This section is optional unless you want to distribute your module (that is, give or sell). However, if you skip this part, be sure to use the module attached with this chapter, instead of your own, before going to the next chapter.

This section is only for PrestaShop 1.5 and newer (module upgrade methods did not exist in PrestaShop 1.4).

Why use an update method? When you improve one of your modules, there may be times you will need to add a SQL table, alter existing ones, or even make specific configuration actions. In most cases, the merchant won't be able to make the updates manually and you can't ask them to uninstall/reinstall the module because, in our case, it means that all the comments posted will be deleted.

Let's add some fields (firstname, lastname, and e-mail address) to the comment form on the product pages. We will not only need to update the PHP and template files, but also alter the mymod_comment SQL table.

First of all, in mymodcomments.php, change the...