langziyang Posted December 27, 2017 Share Posted December 27, 2017 i have one module,on config page i render some helperlist.the code is this: protected function renderList() { $query = new DbQuery(); $query->select('*'); $query->from('carrier'); $query->where('active=1 AND deleted=0'); $rates = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query->build()); $fields_list = array( 'id_carrier' => array( 'title' => $this->l('ID'), 'align' => 'center', 'class' => 'fixed-width-xs' ), 'name' => array( 'title' => $this->l('Carrier') ), 'test' => array( 'title' => $this->l('test'), 'callback' => 'getSetCarrier', ), 'active' => array( 'title' => $this->l('Active'), ) ); $helper = new HelperList(); $helper->shopLinkType = 'shop'; $helper->simple_header = true; $helper->actions = array("edit"); $helper->show_toolbar = false; $helper->module = $this; $helper->listTotal = count($rates); $helper->identifier = 'id_carrier'; $helper->title = ''; $helper->table = $this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name; return $helper->generateList($rates, $fields_list); } public function getSetCarrier() { return 'aaa'; } in the renderList function,i set the callback is getSetCarrier. And in getSetCarrier function,i return string 'aaa'. but,the carrier list is not echo 'aaa' Link to comment Share on other sites More sharing options...
presta-rocks Posted March 26, 2018 Share Posted March 26, 2018 I have same problem, does anyone found a fix for that? Link to comment Share on other sites More sharing options...
thedoc Posted May 15, 2018 Share Posted May 15, 2018 Try to add 'test' in your select query: $this->fields_list = array ( 'test' => array( 'title' => $this->l('test'), 'callback' => 'getSetCarrier', )); $this->_select .= ' \'\' as test '; 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