Notice: You are browsing the documentation for PrestaShop 8, which is currently in development.

You might want to read the documentation for the current version, PrestaShop 1.7.

Order pages new hooks demo tutorial

Introduction

In this tutorial we are going to build a module to extend Order view page and the Orders' preview. The module will add the following components:

  • User Signature card below the Customer card.
  • Additional action buttons in the main buttons bar.

While creating this component you will learn how to:

  • Create a module with namespace thanks to composer
  • [Use Doctrine]({{ relref “/8/modules/concepts/doctrine/” }})
  • Use Repository classes extending Symfony EntityRepository
  • [Use Symfony services]({{ relref “/8/modules/concepts/services/” }})
  • [Use Twig templates to render HTML]({{ relref “/8/development/architecture/migration-guide/templating-with-twig/” }})
  • Various design patterns: Repository, Factory, Presenter
We use this module to demonstrate how to use these concepts/components because they bring some additional value but this is not mandatory. These are just some of the “how to” examples. Would recommend to focus on your project needs and don’t hesitate to write a note to PrestaShop Core developers if we could do it better!

Prerequisites

  • To be familiar with basic module creation.
  • To be familiar with [how Composer autoloads classes]({{ relref “/8/modules/concepts/composer/” }})

Available hooks

On module installation the following hooks can be registered, on the order view page:

  • displayAdminOrderTabLink - for adding tab links for tab content
  • displayAdminOrderTabContent - for adding tab content to Order page
  • displayAdminOrderMain - for adding Order main information
  • displayAdminOrderSide - displayed between Customer and Messages cards in the Order page
  • displayAdminOrderSideBottom - for adding Order side information
  • displayAdminOrder - displayed at the bottom of the Order page
  • displayAdminOrderTop - displayed at the top of the Order page
  • actionGetAdminOrderButtons - to display additional action buttons into the main buttons bar.

And on the listing page:

  • displayOrderPreview - displayed at the bottom of the order’s preview on the order’s listing page.

These hooks are visualized in the picture below:

Order view page hooks locations

Order listing page hooks locations

This tutorial has these sections: