Venky967 Posted February 9, 2017 Share Posted February 9, 2017 Hello everyone, I'm very much new to prestashop but still managed to add a tab in the menu items by creating a new module. Now i need to create a form that contains some input fields and button just like a sign up page after clicking on the tab(CRUD Model) that i created. please have a look at the upload image. Thank you in advance. Link to comment Share on other sites More sharing options...
JeredBolton Posted February 13, 2017 Share Posted February 13, 2017 This page, in addition to providing useful validator for checking your module: https://validator.prestashop.com/auth/login also contains a link at the top of the page to a module generator, which provides a structure for what files (e.g. template and controller) you'll need for your module. If you generate a module, you can examine its structure and see what you need for your module. Link to comment Share on other sites More sharing options...
garytnt Posted February 21, 2017 Share Posted February 21, 2017 Hello, How did you put a new tab on your backoffice ? You have Prestashop 1.7 ? Really need to do it. Thank you in advance. Link to comment Share on other sites More sharing options...
Venky967 Posted February 21, 2017 Author Share Posted February 21, 2017 <?php class YourModule extends Module { //tabs to be created in the backoffice menu protected $tabs = [ [ 'name' => 'Tab Creation', 'className' => 'tabcreation', 'active' => 1, //submenus 'childs' => [ [ 'active' => 1, 'name' => 'Tab1', 'className' => 'tab1', ], ], ], ]; //add a tab in the backoffice menu public function addTab( $tabs, $id_parent = 0 ) { foreach ($tabs as $tab) { $tabModel = new Tab(); $tabModel->module = $this->name; $tabModel->active = $tab['active']; $tabModel->class_name = $tab['className']; $tabModel->id_parent = $id_parent; //tab text in each language foreach (Language::getLanguages(true) as $lang) { $tabModel->name[$lang['id_lang']] = $tab['name']; } $tabModel->add(); //submenus of the tab if (isset($tab['childs']) && is_array($tab['childs'])) { $this->addTab($tab['childs'], Tab::getIdFromClassName($tab['className'])); } } return true; } //remove a tab and its childrens from the backoffice menu public function removeTab($tabs) { foreach ($tabs as $tab) { $id_tab = (int) Tab::getIdFromClassName($tab["className"]); if ($id_tab) { $tabModel = new Tab($id_tab); $tabModel->delete(); } if (isset($tab["childs"]) && is_array($tab["childs"])) { $this->removeTab($tab["childs"]); } } return true; } public function install() { //module installation $success = parent::install(); //if the installation fails, return error if (!$success) { return false; } //create the tabs in the backoffice menu $this->addTab($this->tabs); return true; } public function uninstall(){ $this->removeTab($this->tabs); return parent::uninstall(); } } It will be solved. Link to comment Share on other sites More sharing options...
garytnt Posted February 21, 2017 Share Posted February 21, 2017 Thank you very much, i'll test it. You are on Prestashop 1.7 ? Link to comment Share on other sites More sharing options...
Venky967 Posted February 22, 2017 Author Share Posted February 22, 2017 Yeah I'm using The same. Link to comment Share on other sites More sharing options...
garytnt Posted February 27, 2017 Share Posted February 27, 2017 Doesn't work... My module was on the BO menu in 1.6 but i just upgrade to 1.7 and my module disappear from the BackOffice menu... I don't know why... If someone can help me ? Thank you Link to comment Share on other sites More sharing options...
Venky967 Posted February 27, 2017 Author Share Posted February 27, 2017 After upgrading to 1.7 , Can you see your module inside root/modules folder? Link to comment Share on other sites More sharing options...
garytnt Posted February 27, 2017 Share Posted February 27, 2017 (edited) Yes i see the module in the backoffice too, i can modify the module in the BO too, but it disappear in the BackOffice menu... This link in this menu sent us in another page configuration of our module. Thats why it's very important to recover this link in the BO menu Edited February 27, 2017 by garytnt (see edit history) Link to comment Share on other sites More sharing options...
Venky967 Posted February 28, 2017 Author Share Posted February 28, 2017 Can you please share your code so that I can know where you got wrong 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