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 ...

Get PrestaShop Module Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.