Jump to content

New Admin Tab


wstar
 Share

Recommended Posts

I've been searching a while for this and I can not seem to get it working.  I have already created a new tab under Customers called Teams.  Creating a module which adds the new tab and also loads a .tpl file when clicking on the new tab.

 

File Structure

  • lgs_teams
    • lgs_teams.php
    • icon.png
    • controller
      • admin
        • AdminTeamsController.php
    • views
      • templates
        • admin
          • lgs_teams.tpl

 

 

 

When I click on the new tab, I get a blank page.  Here is my code for the controller.

 

AdminTeamsController.php

<?php
class AdminTeamsController extends ModuleAdminController {
	
    public function __construct() {
 
        $this->table  	  = 'teams';
        $this->className  = 'AdminTeams';
 
        parent :: __construct();
			
	}

	public function initContent()
	{
		parent::initContent();
		return $this->display(_PS_ROOT_DIR_.'/modules/lgs_teams/views/templates/admin/lgs_teams.tpl');
	}
	
	
} // END 

I've tried several things and I can not get the .tpl file to load when clicking the new tab.  Any ideas?  I put the site into debug mode.  No errors display.

 

Thank you for any help.

 

 

Share this post


Link to post
Share on other sites

Hi, try this in AdminTeamsController

public function createTemplate($tpl_name) {
        if (file_exists($this->getTemplatePath() . 'lgs_teams.tpl') && $this->viewAccess())
            return $this->context->smarty->createTemplate($this->getTemplatePath() . 'lgs_teams.tpl', $this->context->smarty);
        return parent::createTemplate($tpl_name);
    }

    public function getTemplatePath() {
        return _PS_MODULE_DIR_ . $this->name . '/views/templates/admin/';
    }
Edited by prestashow.eu (see edit history)

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