PrestaShop Developer Conference
PrestaShop Developer Conference
Paris, France - November 30, 2023
Let's talk code, commerce and open source.

Hook actionFrontControllerSetVariables

Information

Add variables in JavaScript object and Smarty templates:

Add variables to javascript object that is available in Front Office. These are also available in smarty templates in modules.your_module_name.

Hook locations:

  • front office

Hook type: action

Located in:

This hook has an $array_return parameter set to true (module output will be set by name in an array, see explaination here).

Parameters details

      <?php
      array(
        'templateVars' => &(array)
      );
```php
    <?php
    public function hookActionFrontControllerSetVariables()
    {
        return [
            'your_variable_name' => 'Your variable value',
        ];
    }

Call of the Hook in the origin file

Hook::exec(
            'actionFrontControllerSetVariables',
            [
                'templateVars' => &$templateVars,
            ],
            null,
            true
        )