我在fields_list中有几个静态字段,但我希望它们动态添加更多字段,其中title
是Prestashop中我的字段label
数据库的结果。
public function renderResultsList()
{
$this->_select = '
ro.*, rol.*,ruo.*, cus.`id_customer`, cus.`firstname`, cus.`lastname`, cus.`email`, cus.`date_add`' ;
$this->_join = '
LEFT JOIN `' . _DB_PREFIX_ . 'registform_options` ro ON (ro.`id_reg` = a.`id_reg`)
LEFT JOIN `' . _DB_PREFIX_ . 'registform_options_lang` rol ON (rol.`id_option` = ro.`id_option` AND rol.`id_lang` = ' . (int) $this->context->language->id . ')
LEFT JOIN `' . _DB_PREFIX_ . 'registform_user_options` ruo ON (ruo.`id_reg` = a.`id_reg`)
LEFT JOIN `' . _DB_PREFIX_ . 'customer` cus ON (ruo.`id_user` = cus.`id_customer`)';
$this->fields_list = array(
'id_customer' => array(
'title' => $this->l('ID'),
'width' => 'auto',
'align' => 'center'
),
'firstname' => array(
'title' => $this->l('First name'),
'width' => 'auto',
'align' => 'center'
),
'lastname' => array(
'title' => $this->l('Last name'),
'width' => 'auto',
'align' => 'center'
)
);
$ind = 0;
foreach($this->_result as $r){
$this->fields_list[$ind]['label'][$ind] = $r['label'];
$ind++;
}
$this->tpl_list_vars['title'] = $this->l('Results');
return parent::renderList();
}