AFemaleProdigy Posted January 10, 2013 Share Posted January 10, 2013 (edited) 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 January 10, 2013 by AFemaleProdigy (see edit history) 1 Link to comment Share on other sites More sharing options...
Rohit Singhal Posted January 15, 2013 Share Posted January 15, 2013 (edited) got any solution for this? I too am facing the same problem. If you will even use echo inside __construct then header will be shown but "test" will be displayed above it. Edited January 15, 2013 by Rohit Singhal (see edit history) Link to comment Share on other sites More sharing options...
PhiLho Posted January 15, 2013 Share Posted January 15, 2013 I am not sure, but all the classes extending AdminController I see in PS are overriding renderView() instead of display(). And they use Smarty, not echo! And they return parent::renderView() at the end. Link to comment Share on other sites More sharing options...
Rohit Singhal Posted January 15, 2013 Share Posted January 15, 2013 Nope, this ain't the solution. I am not sure, but all the classes extending AdminController I see in PS are overriding renderView() instead of display(). And they use Smarty, not echo! And they return parent::renderView() at the end. Link to comment Share on other sites More sharing options...
AFemaleProdigy Posted January 16, 2013 Author Share Posted January 16, 2013 Anyone know how we should go about making this work? I want to echo some HTML content in my file, wrapped in the admin page template. Link to comment Share on other sites More sharing options...
El Patron Posted January 16, 2013 Share Posted January 16, 2013 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 More sharing options...
El Patron Posted January 16, 2013 Share Posted January 16, 2013 just noticed something try this: class AdminTest extends AdminTab not AdminController Link to comment Share on other sites More sharing options...
Rohit Singhal Posted January 16, 2013 Share Posted January 16, 2013 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 More sharing options...
El Patron Posted January 16, 2013 Share Posted January 16, 2013 Not working. 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 More sharing options...
Rohit Singhal Posted January 16, 2013 Share Posted January 16, 2013 <?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 More sharing options...
sniff Posted March 31, 2013 Share Posted March 31, 2013 (edited) 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 March 31, 2013 by sniff (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now