DrunkBug Posted May 30, 2014 Share Posted May 30, 2014 (edited) I'm writing a custom module, and in module's configuration page, I need to show existing entries in a module's table. I'm using HelperList, but HelperList doesn't generate any list. The strange thing is, that if I'm using $helper->actions = array('edit', 'delete'), then it generates as many empty rows with those buttons as there are rows in that particular database table. Now, the code is as follows: public function getContent() { // ..... $output .= $this->displayList(); return $output; } public function displayList() { // Select all available extra info tabs $sql = 'SELECT * FROM ' . _DB_PREFIX_ . 'extrainfotab'; if ($result = Db::getInstance()->ExecuteS($sql)) { $this->fields_list = array( 'id_extrainfotab' => array( 'title' => 'ID', 'width' => 'auto', 'type' => 'text' ), 'name' => array( 'title' => $this->l('Name'), 'width' => 'auto', 'type' => 'text' ) ); $helper = new HelperList(); $helper->shopLinkType = ''; $helper->simple_header = true; $helper->identifier = 'id_extrainfotab'; //$helper->actions = array('edit', 'delete'); $helper->show_toolbar = false; $helper->title = $this->displayName; $helper->table = $this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name; return $helper->generateList($result, $fields_list); } return false; } And this is the output of $result variable, printed with print_r(): Array ( [0] => Array ( [id_extrainfotab] => 2 [name] => Video ) [1] => Array ( [id_extrainfotab] => 1 [name] => Manuals ) ) Any help will be appreciated. Oh, by the way, I'm using PS 1.6 version. Edited May 30, 2014 by DrunkBug (see edit history) Link to comment Share on other sites More sharing options...
CartExpert.net Posted May 30, 2014 Share Posted May 30, 2014 Hi. You want to display the actions or not? Regards.Robin.The CartExpert Team Link to comment Share on other sites More sharing options...
DrunkBug Posted May 30, 2014 Author Share Posted May 30, 2014 (edited) Hi. You want to display the actions or not? Regards. Robin. The CartExpert Team I'd like to use it, but it's not very neccesery. It's more important to generate a list that is not showing up right now. Also, I just removed if statement, and if there's no entries in database table, it shows that "No entries found" (or something like that, I'm using non-english translation in BO). And if there are some entries - it's just empty table, it doesn't say that there's no entries. Edited May 30, 2014 by DrunkBug (see edit history) Link to comment Share on other sites More sharing options...
CartExpert.net Posted May 30, 2014 Share Posted May 30, 2014 (edited) Hi. The problem seems to be with this line: return $helper->generateList($result, $fields_list); You are storing the values in $this->fields_list, yet you pass $fields_list to the helper class. Try return $helper->generateList($result, $this->fields_list); Regards.Robin.The CartExpert Team Edited May 30, 2014 by CartExpert.net (see edit history) 1 Link to comment Share on other sites More sharing options...
DrunkBug Posted May 30, 2014 Author Share Posted May 30, 2014 Hi. The problem seems to be with this line: return $helper->generateList($result, $fields_list); You are storing the values in $this->fields_list, yet you pass $fields_list to the helper class. Try return $helper->generateList($result, $this->fields_list); Regards. Robin. The CartExpert Team Thank you so much! That was the problem. I didn't noticed it myself. Link to comment Share on other sites More sharing options...
CartExpert.net Posted May 30, 2014 Share Posted May 30, 2014 Happy we could help. Regards.Robin.The CartExpert Team 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