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

Chapter 5. Front Controllers, Object Models, and Overrides

Throughout the previous chapters, we wrote all the PHP code in only one class: MyModComments. This class now handles install/uninstall actions, display on the front office, process triggered by the user's actions, and module configuration in the back office. If we write a more complex module, the code would become hard to read and upgrade. Another point is that, for now, we only added a display to the existing page (for example, product page), and didn't create a new page.

In this chapter, you will learn about controllers and object models. Controllers handle the display on the front and permit us to create a new page type. Object models handle all required database requests.

We will also see that, sometimes, hooks are not enough and can't change the way PrestaShop works. In these cases, we will use overrides, which permit us to alter the default process of PrestaShop without making changes to the core code.

In this chapter, we will...