Jump to content

Create New Menu Tab In The Backoffice


Recommended Posts

Hi, I have some issues adding a new tab in the backoffice menu.

I successfully created it with this:

public function insertMenuTab() {
        $tab = new Tab();
        //$tab->name = 'Gestione Preventivi';
        $tab->module = $this->name;
        $tab->class_name = 'AdminQuote';
        $tab->id_parent = 0; // Root tab


        foreach (Language::getLanguages() as $l)
            $tab->name[$l['id_lang']] = 'Gestione Preventivi';


        $tab->save();


        return true;
    }

But now I don't know how to show a view.

 

I put the class AdminQuoteController in <module_root>/controllers/admin/AdminQuote.php and it just extends ModuleAdminControllerCore.

 

What should I do now to show a view? I didn't find anything in the prestashop docs!

 

Link to comment
Share on other sites

Finally, I find this way:

I created the class AdminQuoteController in /controllers/admin/AdminQuote.php that extends ModuleAdminController. With this code inside:

 

class AdminQuoteController extends ModuleAdminController {
    public function renderList() {
        return $this->context->smarty->fetch(_PS_MODULE_DIR_.'preventivi/views/templates/admin/content.tpl');
    }
}

 

This works even without any display(), init(), initContent() or __construct() as I read in other previous threads.

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...