clarkk Posted December 5, 2012 Share Posted December 5, 2012 Hi I'm trying to add an admin tab.. http://doc.prestashop.com/display/PS15/Creating+a+PrestaShop+module#CreatingaPrestaShopmodule-CreatingaPrestaShopmodule Creating the module's back-office tab, and its class Have followed the instructions, and now I need to add the tab "Put the files online, then create the tab by going to the "Employee" tab, then its "Tabs" sub-tab. Click the "Add new" button, and fill-in the fields with the class' name, "AdminTest". Do not confuse "class" with "modules"! Choose an icon (like one from the FamFamFam icon pack: http://www.famfamfam.com/lab/icons/silk/), choose where the tab should go, and save. You are set! Now start customizing it to your needs!" But I don't think it gives sense? I can't find any Employee tab in the backoffice section Link to comment Share on other sites More sharing options...
El Patron Posted December 5, 2012 Share Posted December 5, 2012 try this (1.5) http://screencast.com/t/nhnud7Uf Link to comment Share on other sites More sharing options...
clarkk Posted December 6, 2012 Author Share Posted December 6, 2012 (edited) Ok Have now added this in the db table: ps_tab parent_id: 0 class_name: AdminTest module: Test position: 12 active: 1 I still don't see any new tab?! I can add the menu under a parent, but can't add it as a primary tab in the menu bar? Edit: I need to install the menu from a module installation Edited December 6, 2012 by clarkk (see edit history) Link to comment Share on other sites More sharing options...
Duozhasht Posted December 6, 2012 Share Posted December 6, 2012 I have almost the same issue. I can add the tab, but when i click in the button, it says : Controler not found The controler admintest is missing or is invalid. Link to comment Share on other sites More sharing options...
El Patron Posted December 6, 2012 Share Posted December 6, 2012 (edited) maybe this will be a little more clear: http://screencast.com/t/O9lyxfea $this->name = 'multidomainpro40'; if( !$this->adminInstall()) return FALSE; here is an example of adding the admin tab dynamically via your module code(1.4 but should also work in 1.5)... private function adminInstall() { if (!$idTab = Tab::getIdFromClassName('AdminContactMultiShop')) { $tab = new Tab(); $tab->class_name = 'AdminContactMultiShop'; $tab->module = $this->name; $tab->id_parent = 9; $languages = Language::getLanguages(false); foreach ($languages as $lang) $tab->name[$lang['id_lang']] = 'PrestaMultiShop'; $res &= $tab->save(); $tab->name[(int)(Configuration::get('PS_LANG_DEFAULT'))] = $this->l('AdminContactMultiShop'); } return TRUE; } uninstall code: $tab = new Tab(Tab::getIdFromClassName('AdminContactMultiShop')); $tab->delete(); Edited December 6, 2012 by elpatron (see edit history) 1 Link to comment Share on other sites More sharing options...
Duozhasht Posted December 7, 2012 Share Posted December 7, 2012 I've tried and when i click in the menu i get this http://cl.ly/image/3C3e3M0b3p0L This is the Example: http://www.prestashop.com/forums/index.php?/topic/157626-how-does-admin-tabs-mvc-work/page__view__findpost__p__810446 Link to comment Share on other sites More sharing options...
clarkk Posted December 7, 2012 Author Share Posted December 7, 2012 (edited) The code is not working.. The tab is not installed.. I need to add a new tab with it's own submenu / dopdownmenu class Dynaccount extends Module { const TBL_CACHE = 'dynaccount_cache'; const TBL_LOG = 'dynaccount_log'; public function __construct(){ $this->name = 'dynaccount'; $this->tab = 'Dynaccount'; $this->version = 1.0; $this->author = 'Dynaccount'; $this->need_instance = 0; parent::__construct(); $this->displayName = $this->l('Dynaccount'); $this->description = $this->l('Dynaccount API integration'); } private function adminInstall(){ if(!$idTab = Tab::getIdFromClassName('AdminDynaccountCache')){ $tab = new Tab(); $tab->class_name = 'AdminDynaccountCache'; $tab->module = $this->name; $tab->id_parent = 0; $languages = Language::getLanguages(false); foreach($languages as $lang){ $tab->name[$lang['id_lang']] = $this->tab; } $res &= $tab->save(); $tab->name[(int)(Configuration::get('PS_LANG_DEFAULT'))] = $this->l('AdminDynaccountCache'); } return true; } public function install(){ if(!parent::install() || !$this->registerHook('actionPaymentConfirmation') || !$this->registerHook('actionProductAdd')){ return false; } $this->adminInstall(); Db::getInstance()->Execute("CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_.self::TBL_CACHE."` (" ."`id` int(10) unsigned NOT NULL AUTO_INCREMENT," ."`is_booked` tinyint(1) unsigned NOT NULL," ."`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP," ."`order_id` int(10) unsigned NOT NULL," ."`invoice_number` int(10) unsigned NOT NULL," ."`total` decimal(8,2) NOT NULL," ."`vat` decimal(8,2) NOT NULL," ."PRIMARY KEY (`id`)," ."KEY `is_booked` (`is_booked`))"); Db::getInstance()->Execute("CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_.self::TBL_LOG."` (" ."`id` int(10) unsigned NOT NULL AUTO_INCREMENT," ."`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP," ."`msg` varchar(255) NOT NULL," ."PRIMARY KEY (`id`))"); return true; } public function hookActionProductAdd($params){ $params['order_id'] = 1; if($order = $this->get_order($params['order_id'])){ $this->put_cache($params['order_id'], $order); } $this->update_cache(); } public function hookActionPaymentConfirmation($params){ } } Edited December 7, 2012 by clarkk (see edit history) Link to comment Share on other sites More sharing options...
clarkk Posted December 7, 2012 Author Share Posted December 7, 2012 the row is created in the ps_tab table in the database, but no new tab in the menu bar? Link to comment Share on other sites More sharing options...
clarkk Posted December 13, 2012 Author Share Posted December 13, 2012 (edited) @ elpatron Ok, I have given up trying to add a new menu point, but instead adding it as a child to "Orders" This code works in version 1.5, but not in 1.4 Could you please help? if(!Tab::getIdFromClassName('AdminDynaccountCache')){ $tab = new Tab(); $tab->class_name = 'AdminDynaccountCache'; $tab->id_parent = 10; $tab->module = $this->name; $languages = Language::getLanguages(false); foreach($languages as $lang){ $tab->name[$lang['id_lang']] = 'Dynaccount cache'; } $tab->save(); } Edited December 13, 2012 by clarkk (see edit history) Link to comment Share on other sites More sharing options...
Indiesservice Posted April 2, 2013 Share Posted April 2, 2013 same problem like as Duozhasht when creating the new tab BO when click the that BO tab then Controller not found The controller adminnotfound is missing or invalid. this type of error occur in backoffice please help me remove the error Link to comment Share on other sites More sharing options...
eadi Posted June 18, 2013 Share Posted June 18, 2013 same problem like as Duozhasht when creating the new tab BO when click the that BO tab then Controller not found The controller adminnotfound is missing or invalid. this type of error occur in backoffice please help me remove the error I have the same error. I am still searching. If you get it right please share Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted June 20, 2013 Share Posted June 20, 2013 (edited) yes eadi.. you are creating the controller yourmodulename/controllers/admin/Admincontrollername.php class Admincontrollername extends AdminController { } Edited June 20, 2013 by Nishith Nesdiya (see edit history) Link to comment Share on other sites More sharing options...
eadi Posted June 20, 2013 Share Posted June 20, 2013 Thanks . It works. I am a newbie. It doenst give the error anymore, but how do I get to go to a module, like a return but with link? Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted June 21, 2013 Share Posted June 21, 2013 you welcome..reading this doc.prestashop.com/display/PS15/Creating+a+PrestaShop+module i hope,you will help this... 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