Jump to content

Add new function to module by override class?


Kerm

Recommended Posts

Hello,

 

I need a help. Prestashop 1.6.1.2

 

Can i override module class and add new function?

 

I try do this:

<?php

if (!defined('_PS_VERSION_'))
    exit;


class BlocktopmenuOverride extends Blocktopmenu
{
    public function hookDisplayMyHook($param)
    {
        $this->user_groups = ($this->context->customer->isLogged() ?
            $this->context->customer->getGroups() : array(Configuration::get('PS_UNIDENTIFIED_GROUP')));
        $this->page_name = Dispatcher::getInstance()->getController();
        if (!$this->isCached('blocktopmenu.tpl', $this->getCacheId())) {
            if (Tools::isEmpty($this->_menu)) {
                $this->makeMenu();
            }

            $shop_id = (int)$this->context->shop->id;
            $shop_group_id = Shop::getGroupFromShop($shop_id);

            $this->smarty->assign('MENU_SEARCH', Configuration::get('MOD_BLOCKTOPMENU_SEARCH', null, $shop_group_id, $shop_id));
            $this->smarty->assign('MENU', $this->_menu);
            $this->smarty->assign('this_path', $this->_path);
        }

        $html = $this->display(__FILE__, 'blocktopmenu.tpl', $this->getCacheId());
        return $html;
    }
}

But in back office in hooks possition i dont see new hook for this module...what i do wrong?

Edited by Kerm (see edit history)
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...