voylinux Posted June 27, 2014 Share Posted June 27, 2014 Is it possible to make the whole process of adding a new menu item to backoffice using just a module? I mean, not going to going to Administration > Menus , but everything via code, included in my module. I want to make that an automatic task to different installations just by installing the module. Could anybody explain all the files and classes that would be necessary? Thank you. Link to comment Share on other sites More sharing options...
bellini13 Posted June 27, 2014 Share Posted June 27, 2014 you could probably search and find related topics http://www.prestashop.com/forums/topic/249135-how-to-create-new-tab-in-admin/ Link to comment Share on other sites More sharing options...
voylinux Posted June 30, 2014 Author Share Posted June 30, 2014 Hello bellini13, thanks for the link I did not find that info before. I was a little bit lost because I found a lot of diferent incomplete links. But in that one you point there is a lot of helpfull info. Link to comment Share on other sites More sharing options...
voylinux Posted June 30, 2014 Author Share Posted June 30, 2014 Hello, I have followed all indicatons I found in creating the custom tab in my module but I get the next error: [PrestaShopException]Property Tab->name is empty at line 878 in file classes/ObjectModel.php872. 873. $message = $this->validateField($field, $value, $id_lang); 874. if ($message !== true) 875. { 876. if ($die) 877. throw new PrestaShopException($message); 878. return $error_return ? $message : false; 879. } 880. } 881. } but I actuallky have a name defined as a tab property. This is my createTab method in my module installation definition: $tab = new Tab(); $tab->name = 'whatever'; $tab->module = 'whatevermodule'; $tab->className = 'WhatEver'; $tab->id_parent = 0; $tab->add(); Thank you for your help. Link to comment Share on other sites More sharing options...
bellini13 Posted June 30, 2014 Share Posted June 30, 2014 I'm going to guess here that the Tab name is a language field, which means you cannot set the name field directly. You basically need to iterate through all the installed languages and set the name as an associative array. I did not test this, but give it a try foreach (Language::getLanguages(false) as $language) $tab->name[$language->id]='whatever'; Link to comment Share on other sites More sharing options...
voylinux Posted June 30, 2014 Author Share Posted June 30, 2014 I'm going to guess here that the Tab name is a language field, which means you cannot set the name field directly. You basically need to iterate through all the installed languages and set the name as an associative array. I did not test this, but give it a try foreach (Language::getLanguages(false) as $language) $tab->name[$language->id]='whatever'; I understand your point. I think the problem is related to that. But changing to this code gives me same error. Link to comment Share on other sites More sharing options...
bellini13 Posted June 30, 2014 Share Posted June 30, 2014 as I said, i did not test this, only showing you the concept that needs to occur. you will need to dig further to determine what exactly needs to be coded for it to work properly. Link to comment Share on other sites More sharing options...
voylinux Posted June 30, 2014 Author Share Posted June 30, 2014 Yes, I understand. Really thanks for your help. 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