Jump to content

Admin Tab


Recommended Posts

Since I don't know whether you want to do a tab with a table or a tab with text fields, I can only give you general advice. Create a file in admin/tabs called AdminYourTab.php. Change YourTab to an appropriate name for the tab. Just look at existing tabs and copy how they are done. Here's a template for what to put in the file:

<?php

include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');

class AdminYourTab.php extends AdminTab
{
   public function __construct()
   {
       // Initialise the tab by linking it to a database table and setting its default permissions

       parent::__construct();
   }

   public function postProcess()
   {
       // This function is executed when the Submit button is clicked
       // Use it to store the value of text fields in the database

       parent::postProcess();
   }

   public function displayForm($token=NULL)
   {
       // This function can be used to create a form with text fields
   }
}

?>



Once you've created a file for the tab, you can go to Tools > Tabs and add the tab. Enter the Name as what you want displayed on the tab, enter AdminYourTab under Class, choose an icon for your tab, and choose the Parent. If you select "Home", it will become a big tab at the top. If you select another tab like "Catalog", your tab will appear as a subtab of that tab.

Link to comment
Share on other sites

  • 2 years later...
×
×
  • Create New...