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

Adding an admin controller


An admin controller has some native methods that permit you to administrate a selected ObjectModel class. As you will see in the following section, creating an admin tab that uses main Create, Read, Update, and Delete (CRUD) actions is very easy.

Adding and installing a new tab to your admin panel

Firstly, we will create a new file named AdminMyModCommentsController.php and we will place it in controllers/admin/ of our module's directory. The file will contain a controller named AdminMyModCommentsController that extends ModuleAdminController:

<?php
class AdminMyModCommentsController extends ModuleAdminController
{

}

Next, we will create a new tab in our back office. You could do so using the admin panel by navigating to Administration | Menus; but, it's not really a plug and play module if merchants have to add the tab themselves. This is why we will add a new method named installTab in our module's main class in mymodcomments.php.

We saw what an ObjectModel class...