Jump to content

use hook "DisplayCustomization"


Recommended Posts

Hi everyone,

I started in Prestashop development for a few days.

I try for a few hours to graft a simple template on the displayCustomization hook.

To do this here is what I did:

1 / Recording the hook in the installation method

$this->registerHook('displayCustomization')

2 / Definition of the display method in the main file of my module

public function hookDisplayCustomization($params){
    return $this->display(__FILE__, 'custom.tpl');
} 

3 / Creating the template file in modules \ mymodule \ views \ templates \ hook \ custom.tpl

<!-- Block custom -->
<div id="mymodule_block_custom" class="block">
    <div class="block_content">  
        <p> hello world </p>  
    </div> 
</div> 
<!-- /Block custom -->

Unfortunately, when I go on a product page with the customization enabled nothing is displayed ...

Besides, should it be activated?

Of course I tried to reinstall the module, reset it etc.

Link to comment
Share on other sites

Hi...

I thing the problem of your path file display try this.

public function hookDisplayCustomization($params){
    return $this->display(__FILE__, 'custom.tpl');
}

TO

public function hookDisplayCustomization($params){
    return $this->context->smarty->fetch($this->local_path . 'views/templates/hook/custom.tpl'); //path of your template file
}

 

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...