Jump to content

Problem with custom admin tab. Can't get echo to work properly.


AFemaleProdigy

Recommended Posts

I have created a custom admin tab (1.5) that I want to show my custom content. If I exclude the display function, then the page template shows up just fine with the store header and footer. But when I add the display/echo function, the header and footer disappears and all I see is what is in the echo function (blank white page with "TEST" text). Can someone help me with this so that the store header/footer does not disappear? Thanks!

 

Here is the code I was using that is not working quite right...

 

class AdminTest extends AdminController
{
public function __construct()
{
 parent::__construct();
}

public function display()
{
 echo 'TEST';
}
}

Edited by AFemaleProdigy (see edit history)
  • Like 1
Link to comment
Share on other sites

I compared this to my working admintabs and other than not having a return; at the end of your display function, I don't see why this would not work. btw You don't need the __construct if you are not declaring anything...

 

I've written a couple admintabs that are working in many shops loaded by modules....honestly I avoid admin tabs at all costs and have moved to putting them in the configuration of the module....but I know that is not always the best place...

 

did you add the admin tab manually via the back office?

Link to comment
Share on other sites

Not working.

 

I compared this to my working admintabs and other than not having a return; at the end of your display function, I don't see why this would not work. btw You don't need the __construct if you are not declaring anything...

 

I've written a couple admintabs that are working in many shops loaded by modules....honestly I avoid admin tabs at all costs and have moved to putting them in the configuration of the module....but I know that is not always the best place...

 

did you add the admin tab manually via the back office?

just noticed something try this:

 

class AdminTest extends AdminTab

 

not AdminController

Link to comment
Share on other sites

<?php

class AdminAdministerControllerCore extends AdminTabsControllerCore OR AdminTabsController

{

public function __construct()

{

parent::__construct();

echo 'hello';

[spam-filter]?>

Above code is displaying 'hello' above header and administration->menus is displayed.

 

<?php

class AdminAdministerControllerCore extends AdminTabs

{

public function __construct()

{

parent::__construct();

echo 'hello';

[spam-filter]?>

Above code is giving server error

 

 

<?php

class AdminAdministerControllerCore extends AdminController

{

public function __construct()

{

parent::__construct();

echo 'hello';

[spam-filter]?>

Displaying hello above header, tried to give echo in a new function and called that but that also gave same result.

 

please stop posting it's not working...post your code that is not working...

 

my admin tabs work

Link to comment
Share on other sites

  • 2 months later...

Hello.

 

I am trying to write module which will be used only in back-office (for administration purposes). And I need seperate menu (with submenus) for this module to manage its functionalities.

 

I am not sure if I correctly understand how to manage files in presta. Maybe you could help me?

 

As I understood I should:

 

1. create a folder mymodule in modules catalogue.

2. in this folder save php file with MyModule class derived from Module base class. MyModule has install uninstall methods in which I can create tables in database, new tabs in back-office menu etc.

3. in mymodule catalogue create: controllers/admin catalogue and place there controllers for menu and submenus.

4. where should I put classes for new menu tabs? Separately in classes catalogue? How to perform installation of such module? (I don't want to force users to copy files on their own) Those new tab-classes should be derived from what base class?

 

I am wondering how to write back-office module which will be consistent with MVC architecture.

'tab classes' are model classes and should be responsible for database queries, right?

Forms and tables (visualisation in back-office) is generated by controller classes?

 

Thank you in advance for your time.

Cheers,

Ania

Edited by sniff (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...