Table of Contents

Warning: You are browsing the documentation for PrestaShop 1.7, which is outdated.

You might want to read an updated version of this page for the current version, PrestaShop 8. Read the updated version of this page

Learn how to upgrade to the latest version.

Hook tips

Let’s say we need to add some javascript to the ‘Order create’ BO page. So we use hookActionAdminControllerSetMedia. This hook is called on every BO page, so we need to filter the executions.

if ('AdminOrders' === Tools::getValue('controller')) {
    // now we know we are only applying changes to admin order pages,
    // but we aren't yet sure if it's a order create or order view page

In case we are using Prestashop version lower than, then Order page is not yet migrated to Symfony framework and we can check if it has following query parameters:

if (Tools::getValue('addorder')) {
    // this way we know this is order create page

if (Tools::getValue('vieworder')) {
    // this way we know this is order view page

If we are using Prestashop or above, then Order page is already migrated to Symfony framework, meaning that each page has its own route and a dedicated action, so one way to check which route we are in would be to extract it from request like following:

$currentRoute = \PrestaShop\PrestaShop\Adapter\SymfonyContainer::getInstance()

if ('admin_orders_create' === $currentRoute) {
    // now we know for sure, that we are in order create page

Other methods are available. For example, thanks to LegacyParametersConverter which was introduced in, you can get controller action parameter using following approach:

$action = Tools::getValue('action');

The configuration legacy_params for migrated page allows to link legacy parameters with new Symfony routes. If they are configured correctly, above mentioned code snippet should return ‘addorder’. So you can use the legacy parameters to check a Symfony page identity.