pipo_ Posted January 27, 2014 Share Posted January 27, 2014 hi, i am build new module for administration, but i have problem with helperList (http://doc.prestashop.com/display/PS15/HelperList) i can load products to list, but pagination is not working, also helperList returns 0 in total results $helperList = new HelperList(); $helperList->bulk_actions = array( 'delete'=>array( 'text'=>$this->l('Delete selected'), 'confirm'=>$this->l('Delete selected items?')) ); $helperList->_select = Product::getProducts($this->context->language->id, 0, '','id_product','ASC'); $helperList->_defaultOrderBy = 'id_product'; $fields_list = array( 'id_product' => array( 'title' => $this->l('ID'), 'align' => 'center', 'width' => 50, ), 'name' => array( 'title' => $this->l('Name'), 'width' => 'auto' ) ); $helperList->identifier = 'id_product'; $helperList->title = $this->l('Produkty a kategórie'); $helperList->token = Tools::getAdminTokenLite('AdminModules'); $helperList->currentIndex = AdminController::$currentIndex.'&configure='.$this->name; $helperList->table = $this->name.'_products'; return $helperList->generateList($helperList->_select, $fields_list); 1 Link to comment Share on other sites More sharing options...
utekaravinash Posted May 15, 2014 Share Posted May 15, 2014 Were you able to find a solution to your problem? Link to comment Share on other sites More sharing options...
gonebdg - webindoshop.com Posted May 16, 2014 Share Posted May 16, 2014 Why you are use $helperList->_select to define your data list ? There is no protected variable $_select within Helper object Total numbers of data results, should be defined using $listTotal variable in your helper object.If listTotal is undefined, then it will use 0 as defaut value and then your pagination won't work because the total page = 1 Pagination also won't work if the total number of data less than pagination value $fields_list['id_whatever'] = array( 'title' => $this->l('ID'), 'align' => 'center', 'type' => 'int', 'width' => 40 ); $fields_list['name'] = array( 'title' => $this->l('Name'), 'filter_key' => 'b!name' ); $result = // your query here, 2 dimensional array(), e.g array(array('id_whatever' => 1, 'name' => 'whatever')) $helper = new HelperList(); $helper->listTotal(count($result)); // define the total numbers of result to be displayed // rest of helper vars return $helper->generateList($result, $fields_list); 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