How to make Homeslider Banner work in custom hook location

513 views Asked by At

I've very new to Prestashop (familiar with Joomla, Virtuemart, Magento etc, jQuery HTML CSS)...

I'm trying to create a custom hook and transplant an existing module (homeslider) into it. So far, I've managed to create the hook, and display the homeslider module. But the banner is not being displayed correctly (banner images are below one another) - it seems that the js and css files are not being called correctly. I've bashed away at this thing for a couple of days now - re-purposed some functions like hookdisplayHeader, hookdisplayTopColumn - but I'm still getting the same result.

This is what I've done so far:

Registered the Hook:

$this->registerHook('MondayTest')

Called the hook:

public function hookMondayTest($params)
{
    if (!isset($this->context->controller->php_self) || $this->context->controller->php_self != 'index')
        return;

    if (!$this->_prepareHook())
        return false;

    return $this->display(__FILE__, 'homeslider.tpl');
    return "MondayTest5";
}

Called the hook in footer.tpl (for testing purposes):

{hook h="MondayTest"}

But it's not working correctly... What am I doing wrong?

Please help! Your assistance is greatly appreciated in advance!

2

There are 2 answers

0
unloco On

The safest way to 'move' a module from one hook to another custom hook is to use the call the original hook handler method

Example:

public function hookMondayTest($params)
{
    return $this->hookDisplayTopColumn($params);
}

If you want to change the bahviour of the module on the custom hook, you will need to copy all the code from the original method and modify on it accordingly

0
Fil0z0 On

You should create a method in module classe that return what you want see

public function hookMondayTest($params)
{
   return $this->hookDisplayHome($params);
}

then you need to go in back office and transplant the module in your hook module-position-transplant a modul