Shagshag
7/17/2013 - 8:30 PM

Custom hook example with Prestashop

Custom hook example with Prestashop

<?php
    class ExampleModule extends Module {
        public function install()
        {
            $done = (
                parent::install()
                && $this->registerHook('displayFooter')
                && $this->registerHook('displayRandom')
            );
            return $done;
        }
        
        public function hookDisplayFooter($params)
        {
            return $this->display(__FILE__, 'footer.tpl');
        }
        
        public function hookDisplayRandom($params)
        {
            return rand($params['min'], $params['max']);
        }
    }
<p>{l s='Here is a random number:'} {hook h='displayRandom' min=5 max=15}</p>