Jump to content

Create template for module in BO


Recommended Posts

Hi, i have create a simple moduke that add some tab in bo menù.

 

Actually i click on tab create and on right i see a page black with module title on the header.

 

This is the simple code:

<?php

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

class Farmacustom extends Module
{
    public function __construct()
    {
        $this->name = 'farmacustom';
        $this->tab = 'administration';
        $this->version = '1.0.0';
        $this->author = 'author';
        $this->need_instance = 0;
        $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
        $this->bootstrap = true;

        parent::__construct();

        $this->displayName = $this->l('Farma Custom');
        $this->description = $this->l('Funzioni custom');

        $this->confirmUninstall = $this->l('Are you sure you want to uninstall?');
    }

    public function install()
    {
        Configuration::updateValue('FARMACUSTOM_LIVE_MODE', false);

        $tab = new Tab();
        $tab->class_name = 'Farmacustom';
        $tab->module = $this->name;
        $tab->active = 1; //Status
        $tab->id_parent = 0;
        $languages = Language::getLanguages(false);
        foreach ($languages as $lang){
            $tab->name[$lang['id_lang']] = 'Presta';
        }
        $tab->save();
        $tab_id = $tab->id;

        $tab = new Tab();
        $tab->class_name = 'Farmacustom';
        $tab->module = $this->name;
        $tab->id_parent = $tab_id;
        $tab->active = 1; //Status
        $languages = Language::getLanguages(false);
        foreach ($languages as $lang){
            $tab->name[$lang['id_lang']] = 'Presta Bis';
        }
        $tab->save();
        
        return parent::install() &&
        $this->registerHook('displayBackOfficeHeader');
    }

    public function uninstall()
    {
        Configuration::deleteByName('FARMACUSTOM_LIVE_MODE');

        return parent::uninstall();
    }

    public function hookDisplayBackOfficeHeader(){
        
    }
}

How i can manage the pages create from this module?

I would create other tab and every tab have a page with a form or other information that i would create in a template .tpl.

 

Someone can help me?

 

Thanks a lot.

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More